Filter by custom post field
-
Hi there,
I am running this plugin on a WP install with a custom post type that has as a custom post field called ‘popularity’ (formatted as “number”).
Now, I want to create a list, that only shows posts with a popularity value below the value of 10.
To do so, I have followed Tom’s instructions here and adjusted the plugin itself to allow for additional arguments.
I now use the following code, as suggested in this support article, but unfortunately, I receive the following fatal error:
Uncaught Error: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
This is the code I use in my functions.php:
add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) { if ( 4566 === $settings['list_id'] ) { $args['meta_query'] => array( array( 'key' => 'popularity', 'value' => 10, 'compare' => '<', ) ); } return $args; } );
What do I do wrong?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Filter by custom post field’ is closed to new replies.