Open luciobatistella opened 4 years ago
Hello, I am using CPT UI to create my type posts. Even watching a video showing how to make the filter, mine did not work. I added the code in functions and I call it rest_post_query also for custom post?
`add_filter( 'rest_post_query', function( $args ) { $fields = array( 'tipo_cadastro' );
foreach ( $fields as $field ) { if ( isset( $_GET[ $field ] ) && ! empty( $_GET[ $field ] ) ) { $args['meta_query'][] = array( 'key' => $field, 'value' => esc_sql( $_GET[ $field ] ), ); } } return $args;
} );`
Hello, I am using CPT UI to create my type posts. Even watching a video showing how to make the filter, mine did not work. I added the code in functions and I call it rest_post_query also for custom post?
`add_filter( 'rest_post_query', function( $args ) { $fields = array( 'tipo_cadastro' );
} );`