Custom Permalink Tag breaks Pagination

Thanks to Milo’s help the code in the question ended up working: permalinks fixed and the structure stayed exactly how I wanted it described in the question above. Removed the rewrite_rules_array hook entirely Moved my taxonomy registration above my post type registration Changed the taxonomy to be non-hierarchical ‘hierarchical’ => false From my limited understand … Read more

Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?

With helpful tips from Milo, I was able to remove the taxonomy slug when no taxonomy is assigned to the custom post type by adding the following code to the updated functions above: add_filter( ‘request’, ‘project_request_filter’ ); function project_request_filter( $request ){ if( array_key_exists( ‘project’ , $request ) && ! get_term_by( ‘slug’, $request[‘project’], ‘project’ ) ){ … Read more

Using pre_get_posts to Filter Posts

You’re creating a new query, not altering the existing one. The pre_get_posts codex page has a note explaining that the $query argument is passed by reference and you should alter it directly. There’s no need to declare globals or return values. Update your function to be: add_action( ‘pre_get_posts’, ‘only_current’ ); function only_current( $query ) { … Read more

Taxonomy , subtaxonomy,child taxonomy of a product woocommerce

Based on this answer, here is my function to get all your terms in an array : function get_term_ancestors($post_id, $taxonomy){ // Declare the array where we are going to store the terms $ancestors = array(); // start from the current term $parent = array_shift(get_the_terms($post_id,$taxonomy)); // climb up the hierarchy until we reach a term with … Read more

Dynamically tax_query terms

If $taxonomy_category is already an array, then: ‘terms’ => array($taxonomy_category) should just be: ‘terms’ => $taxonomy_category where $taxonomy_category is equal to whatever was submitted from your form as $_POST[‘taxonomy_category’] or $_GET[‘taxonomy_category’]