WP meta_query args not working in function

You’re very close to it just need to to modify your code little bit. See I’ve update code for you. function my_super_filer_function2($query_args){ global $post; $post_author = $post->post_author; $query_args[‘author’] = $post_author; $query_args[‘post_status’] = array(‘publish’, ‘future’); $query_args[‘meta_query’] = array( array( ‘key’ => ‘zobrazitnatridy’, ‘value’ => ‘Ne’, ‘compare’ => ‘!=’ ) ); return $query_args; } add_filter(‘my_super_filter2’, ‘my_super_filer_function2’);

search based on custom field

Add these filters to your functions.php file /** * Join posts and postmeta tables * * @link https://developer.wordpress.org/reference/hooks/posts_join/ */ add_filter( ‘posts_join’, function( string $sql, WP_Query $query ) { global $wpdb; if ( !is_admin() && $query->get( ‘search_meta’ ) ) { $sql .= ‘ LEFT JOIN ‘ . $wpdb->postmeta . ‘ ON ‘ . $wpdb->posts . ‘.ID … Read more