Custom taxonomy rewrite with query var returns %2F in URL
Custom taxonomy rewrite with query var returns %2F in URL
Custom taxonomy rewrite with query var returns %2F in URL
Put this code into your function.php. add_filter(‘redirect_canonical’,’pif_disable_redirect_canonical’); function pif_disable_redirect_canonical($redirect_url) { if (is_singular()) $redirect_url = false; return $redirect_url; } Hope this will help you
$term isn’t being set anywhere in your code. You’re putting IDs into $terms_ids, but then in your query you’re using $term->term_id. $term doesn’t exist outside of the foreach. You need to be passing $terms_ids directly into terms: $terms = get_the_terms( get_the_ID(), ‘kosmetyki_dystrybutor’); $terms_ids = []; foreach ( $terms as $term ) { $terms_ids[] = $term->term_id; … Read more
Pretty URL for custom search for custom post type
So, after some discussion in other forums, I searched for a plugin to help on the matter and after finding nothing useful, I decided to go other way. Since it looks like WordPress can’t handle this structure, I’m gonna do a workaround and explain it here because it might be helpfull to others. MY SOLUTION: … Read more
As has already been noted, you can do this by iterating over each of the terms, which are WP_Term objects. Each of those WP_Term objects has a name property. So you’d do it like this: $terms = get_the_terms( $post->ID, ‘cpt_saving-type’ ); $terms = is_array( $terms ) ? $terms : array(); foreach ( $terms as $term … Read more
wp_insert_term created and set for first once only
Categorize custom post type
As you have no idea what the theme templates look like, any attempt to build a ‘neutral’ template is likely to screw up at some point. So your best bet is to hook into elements of the single and archive pages (which may have no separate template – maybe it’s a one template theme). Really … Read more
Metabox not show in categories custom post type cmb2