remove post-name from title in custom post type

Fixing the 404 error So it’s because of the ([^&]+) in your add_rewrite_tag() calls: $wp_rewrite->add_rewrite_tag(‘%reference%’, ‘([^&]+)’, ‘reference=”); //$wp_rewrite->add_rewrite_tag(“%location%’, ‘([^&]+)’, ‘location=’); To fix the error, you should use ([^/]+) and not ([^&]+). I also intentionally commented out the second line because if the taxonomy’s slug is location, then WordPress should have already added the %location% rewrite … Read more

Exclude Custom Post Type & Pages From Auto-Tag Function

In save_post action you can access to the objet of the saved post and check the post type before tagging it: add_action( ‘save_post’, ‘add_authors_name’, 10, 2 ); function add_authors_name( $post_id, $post ) { // The post types you want be tagged to $valid_post_types array $valid_post_types = array( ‘post’, ‘community’ ); if( in_array( $post->post_type, $valid_post_types) ) … Read more

Custom post type category, taxonomy and URL rewrite problem

Welcome to WPSE. That can be solved pretty straight forward. Register a custom post type products Register two taxonomies (brands and functionalities) for your custom post type Feed WordPress the correct template, following the template hierarchy and WordPress standard Flush your rewrite rules (can’t be skipped, but is easy) Step 1 Register your custom post … Read more

How to let custom post type posts show in standard post archive (like in homepage)?

Hooking the following function with the pre_get_posts filter will add one or more CPTs to the regular archive pages: function wpse94041_cpts_in_archives( $query ) { if( is_category() || is_tag() ) { // more conditional tags possible, if applicable $query->set( ‘post_type’, array( ‘post’, ‘tutorial’ // add as many CPTs to this array as you like )); } … Read more

Add filter to wp_list_categories and query what type of taxonomy-terms it use?

WordPress do: apply_filters( ‘wp_list_categories’, $output, $args ); You can do: function add_slug_css_list_categories($list,$args) { } Then you can use $args to determine what kind of list you have. Not sure if you must do that but when you add the filter there is also a variable for accepted arguments: add_filter(‘wp_list_categories’, ‘add_slug_css_list_categories’,10,2);