Adding Taxonomies to Custom Post Type Without Displaying Blog Post Categories

Thanks to @Jacob Peattie for pointing me in the right direction. I was able to get the code to display exactly what I needed it to with the following syntax. My intent was to get an admin level category page to only display new categories for contractors like painters, fencing, roofers, etc. Initially, it redirected … Read more

WP Query – Can’t get posts with specific taxonomy

It appears that you’re attempting to add a function to the init action hook from within the function you’re trying to add. Your code is doing this: function portalp_custom_taxonomies() { // … add_action( ‘init’, ‘portalp_custom_taxonomies’ ); // … } …when it needs to do this: function portalp_custom_taxonomies() { // … } add_action( ‘init’, ‘portalp_custom_taxonomies’ ); … Read more

Have Custom Taxonomy Slug Fall Under Custom Post Type Slug

You can do that by writing a function using the ‘generate_rewrite_rules’ WordPress hook. https://developer.wordpress.org/reference/hooks/generate_rewrite_rules/ <?php function guides_cpt_generating_rule($wp_rewrite) { $rules = array(); $terms = get_terms( array( ‘taxonomy’ => ‘venue-type’, ‘hide_empty’ => false, ) ); $post_type=”guide”; foreach ($terms as $term) { $rules[‘guide/’ . $term->slug . ‘/([^/]*)$’] = ‘index.php?post_type=” . $post_type. “&guide_post_type=$matches[1]&name=$matches[1]’; } // merge with global rules … Read more