Allow duplicate slugs for custom post type with taxonomies
Allow duplicate slugs for custom post type with taxonomies
Allow duplicate slugs for custom post type with taxonomies
// set Selected Post CATEGORY cheked wp_set_object_terms( $post_id, array((int)$_POST[‘movies_cat’]), ‘movies’ ); } else{ die(“check seccurity”);} // This bellow given code add on design page <p class=”meta-options hcf_field”> <label for=”movies”>The Categories</label> <?php wp_dropdown_categories( ‘taxonomy=movies&name=movies_cat&show_option_all=Select a category’ ); ?> </p>
Querying by postmeta is very inefficient, so for a site with many posts, you’re likely to run into issues. In this type of situation you’re almost always better off creating custom taxonomies. Taxonomy queries are much less demanding and scale better on larger sites.
You can use ‘type’ => ‘DECIMAL(10, 2)’, in meta query. It is mentioned in the documentation Custom_Field_Parameters.
Return terms from multiple taxonomies using $wpdb
Get taxonomy based on another taxonomy slug
To get the URL like example.tld/portfolio/PORTFOLIO-CATEGORY-NAME/PORTFOLIO-NAME/ do the following. Change rewrite for the custom post type to ‘rewrite’ => array( ‘slug’ => ‘portfolio/%portfolio-categorie%’, ‘with_front’ => false ), Change rewrite for the custom taxonomy to ‘rewrite’ => array( ‘with_front’ => false ), Use post_type_link filter to replace %portfolio-categorie% with the actual taxonomy term: add_filter( ‘post_type_link’, ‘my_portfolio_permalink’, … Read more
I’ve pasted your code in Twenty Nineteen and it works as expected with Classic Editor ( and I’m sure it will work pre-Block Editor also ). Your taxonomy will not show up in the Block Editor unless you specify to display that taxonomy in rest as you’ve done with your post type: register_taxonomy( ‘product-category’, ‘product’, … Read more
the WordPress function cat_is_ancestor_of() is made for WordPress categories, but not for WooCommerce product categories which is a custom taxonomy product_cat. For Custom taxonomies you can use WordPress term_is_ancestor_of() function like: term_is_ancestor_of( 19, get_queried_object_id(), ‘product_cat’ ) So in your code: if ( is_product_category( ‘foo-category’ ) || term_is_ancestor_of( 19, get_queried_object_id(), ‘product_cat’ ) ) { wc_get_template( ‘archive-foo.php’ … Read more
Query taxonomy of taxonomy of custom post type