How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?

If I try to add &posts_per_page=15 to url, it doesn’t work: it won’t change number of post. I wonder if you’re looking for a custom query variable, e.g. ppp, to change the number of posts for the main query: add_filter( ‘query_vars’, function( $vars ) { $vars[] = “ppp”; return $vars; } ); add_action( ‘pre_get_posts’, function( … Read more

Taxonomy question

The short answer is to get your taxonomy terms using: wp_get_post_terms( $post->ID, ‘yourTaxonomyName’ ); This will return an array of WP Term Objects. Here’s how you would get the first term name: $terms = wp_get_post_terms( $post->ID, ‘yourTaxonomyName’ ); $first_term_name = $terms[0]->name; You can learn more about this method in the WordPress Codex: https://codex.wordpress.org/Function_Reference/wp_get_post_terms Hope this … Read more

get the custom taxonomy name?

You can check if term exists, see here add_action( ‘woocommerce_before_single_product’, ‘display_category_list’,20 ); function display_category_list() { global $post; $term = ‘term_name’; // Term name string or array $taxonomy = ‘product_cat’; // your taxonomy if( has_term($term, $taxonomy, $post) ){ // if post belongs to term(s) wc_get_template( ‘woocommerce/single-product/single-product-top- content.php’ ); } }

Remove CPT Slug with 2 taxonomies and 1 post meta

Managed to get it sorted in the end, needed to add a rewrite rule (see below) if you need full source code then let me know and I will be more than happy to paste it. public static function add_rewrite_rules() { add_rewrite_rule( ‘^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?’, ‘index.php?post_type=products&product_holiday=$matches[1]&_product_countries=$matches[2]&_product_types=$matches[3]&name=$matches[4]’, ‘top’ ); } add_action(‘init’, array( __CLASS__, ‘add_rewrite_rules’) ); Thanks,