Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

sant527 on "add_filter not working"

$
0
0

Added the below apply_filters in a file in my theme

$videos_query = apply_filter('mars_main_widget_args',$videos_query,$this->id);
$wp_query = new WP_Query( $videos_query );

In the themes function file i have

if( !function_exists( 'mars_widget_post_ids' ) ){
    /**
     * @param array $query
     * @param string $widget_id
     */
    function mars_widget_post_ids( $query, $widget_id ) {
        if( $widget_id == 'mars-mainvideo-widgets-5' ){
            $query['post__in'] = array( 1,4,5,6 );
        }
        return $query;
    }
    add_filter( 'mars_main_widget_args' , 'mars_widget_post_ids',100,2);
}

The filter is not being applied any mistake


Viewing all articles
Browse latest Browse all 8245

Trending Articles