How to filter post data with AJAX on page?

As you guess that’s what happening(at least I think). You should separate your ajax logic from your “first load” logic. You can make a function ie my_get_posts that will be called inside archive-work.php and then inside ajax_filter_get_posts you can call the my_get_posts() function. archive-work.php <div class=”work-results”> <?php $res = my_get_posts(); echo $res[‘response’]; ?> </div> functions.php … Read more

get_terms() returns an empty array

get_terms returns an array of objects. You cannot echo an array, if you do, you will just get Array(). What you can do is print_r($array) or var_dump($array) or echo json_encode($array) to see the data it contains. Otherwise, to get single elements, e.g. the name, from the objects, you need to pass $tax_terms through a foreach … Read more

Exclude a term of a taxonomy with a custom post type in a search

The problem with your approach is that woocommerces product category is a custom taxonomy called product_cat. But with cat you are addressing the built-in category. Taxonomies can be addressed with a tax query, simplified example below: function wpse188669_pre_get_posts( $query ) { if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { $query->set( ‘post_type’, array( ‘product’ … Read more

Find callback function for custom taxonomy metabox

The callback you need for non-hierarchical taxonomies is post_tags_meta_box. The callback you need for hierarchical taxonomies is post_categories_meta_box. For your example, the code would be: /* Remove movies metabox from sidepanel */ function hide_metabox(){ remove_meta_box( ‘tagsdiv-movies’, ‘your-post-type’ , ‘side’ ); } add_action( ‘admin_menu’ , ‘hide_metabox’ ); /* Add back movies metabox, but in post area … Read more

Custom taxonomies, with custom rewrites/slug, AND loading a taxonomy archive template from a plugin

Background & Core Functionality Why a Taxonomy Path Slug Alone Produces a 404 However this slug doesnt work. mysite.com/wiki/help-topics throws a 404. WordPress does not provide a mechanism for “an archive of taxonomy terms” out of the box – that is, neither the template hierarchy nor the WP_Query/WP_Tax_Query logic support a direct display of terms … Read more

Get the latest taxonomy/category?

The latest edition should always be the term in that taxonomy with the highest term_id, right? Query get_terms and find the latest edition, then use that term to build the rest of your query… $edition = get_terms(‘edition’,’orderby=none&order=DESC&number=1′); $latest_edition = $edition[0]->slug; Then you can either modify the current query, if that’s what you want to do: … Read more