modify_media_query missing argument


#1

I have recently upgraded to rtMediaPro, everything works fine but this wild error messages appeared:

  
Warning: Missing argument 2 for RTMediaProAttributes::modify_media_query()   
in web\wp-content\plugins\rtmedia-pro\app\main\controllers\media\RTMediaProAttributes.php   

on line 49 Warning: Missing argument 3 for RTMediaProAttributes::modify_media_query() in   
web\wp-content\plugins\rtmedia-pro\app\main\controllers\media\RTMediaProAttributes.php on line 49  

Your function modify_media_query doesn´t seem to need the second and third parameters :

  
function modify_media_query( $media_query, $action_query, $query ) {  
			global $rtmedia_query;  
			global $media_query_clone_attributes; // store media_query for reference  
			$media_query_clone_attributes = $media_query;  
			if( isset( $media_query['attribute_slug'] ) && $media_query['attribute_slug']  != '' && isset( $media_query['term_slug'] ) && $media_query['term_slug']  != '' ){  
				add_filter( 'rtmedia-model-where-query', array( $this, 'rtmedia_model_shortcode_where_query_attributes' ), 10, 3 );  
				add_action( 'rtmedia_before_media_gallery', array( $this, 'remove_rtmedia_model_shortcode_where_query_attributes' ), 10, 3 );  
				unset( $media_query[ 'attribute_slug' ] );  
				unset( $media_query[ 'term_slug' ] );  

				// unset from global query so that multiple gallery shortcode can work  
				if( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['attribute_slug'] ) ) {  
					unset( $rtmedia_query->query['attribute_slug'] );  
					unset( $rtmedia_query->query['term_slug'] );  
				}  
				if ( isset( $media_query[ 'context_id' ] ) ){  
					unset( $media_query[ 'context_id' ] );  
				}  
				if ( isset( $media_query[ 'context' ] ) ){  
					unset( $media_query[ 'context' ] );  
				}  
			}  
			return $media_query;  
		}  

How could i fix this without modifying your plugin?

I actually modify media query using a hook called rtmedia_action_query_modifier_value.


#2

Hi David,

Please check that both the rtMedia and rtMedia-PRO plugins are up-to date as this is already addressed and fixed.


#3

Thanks! I updated rtMedia and now the warning is gone


#4

I am glad to know that :slight_smile:


#5