Include results with tags relevant to the search keyword with JSON rest API v2

WP Extended Search does not work with REST by default since version 2.0.2 This is to achieve maximum compatibility with WordPress and other plugin/themes. To enable the support, pass wpessid in REST request with ID (for specific search setting) or without ID (for global search setting). e.g. /wp-json/wp/v2/posts?search=technology&wpessid or /wp-json/wp/v2/posts?search=technology&wpessid=10 Ref: https://wordpress.org/support/topic/search-queries-with-metakey-name-issue-version-2-0-2/#post-14376988 PS:- I am … Read more

WP REST API – get custom taxonomies based on terms & filter

Herewith find the below answer for my own question for the custom taxonomies based listing the categories add_action( ‘init’, ‘rest_custom_category_request’, 25); function rest_property_type_category_request(){ global $wp_taxonomies; $wp_taxonomies[‘custom_category’]->show_in_rest = true; $wp_taxonomies[‘custom_category’]->rest_base=”custom_category”; $wp_taxonomies[‘custom_category’]->rest_controller_class=”WP_REST_Terms_Controller”; } Answer for the filter with custom meta key & values add_filter(‘rest_query_vars’, ‘custom_rest_query_vars’); function custom_rest_query_vars($query_vars) { //print_r($query_vars);exit; $query_vars = array_merge( $query_vars, array(‘meta_key’, ‘meta_value’, ‘meta_compare’) ); … Read more

Delete taxonomy and delete all post related it

First of all we need to find the posts related to our taxonomy term. Then we will delete them one by one by running a foreach loop. Try below code. I hope that will work for you- add_action(‘pre_delete_term’, ‘the_dramatist_delete_posts_on_taxonomy_delete’, 1, 1 ); function the_dramatist_delete_posts_on_taxonomy_delete( $term ) { $args = array( ‘post_type’ => ‘post’, // post_type … Read more