Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Can I exclude with a custom meta field from a list? Reply To: Can I exclude with a custom meta field from a list?

#13344
Tom
Keymaster

Hmm, it may be possible otherwise.

Make this change in your wp-show-posts.php file: https://github.com/tomusborne/wp-show-posts/commit/286caf1164db8b6b6f38b85d3a011b519a27f4de

Then do this:

add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
    if ( 123 === $settings['list_id'] ) {
        $args['meta_query'] => array(
            array(
                'key' => 'your_custom_field',
                'value' => 'your value to check',
                'compare' => '!==',
            )
        );
    }

    return $args;
} );

You just need to change 123 to your list ID, and adjust the key and value.