New answers tagged

0

The helpful folks on WordPress IRC pointed me to this article, which answered my question: https://make.wordpress.org/core/2015/02/16/taxonomy-term-splitting-in-4-2-a-developer-guide/ In WordPress 4.2, shared taxonomy terms – those items in the wp_terms table that are shared between multiple taxonomies – will be split into separate terms when one of the ...


0

Ok I'v created a admin plugin to do this... If you have better idea :-) I'm in Create a admin button to open a csv file of meta_value to compare with existing products. and update products as featured if exist. add_action('admin_menu', 'featured_button_menu'); function featured_button_menu() { add_menu_page('Featured Products Page', 'Mise en avant ...


0

First, get all term slugs from the custom example taxonomy space by current post ID. $space_terms = wp_get_post_terms( $post->ID, 'space' ); if( $space_terms ) { $space_terms = array(); foreach( $space_terms as $term ) { $space_terms[] = $term->slug; } } You should specify the logical relationship between each inner taxonomy array when there ...


0

The function wp_set_object_terms relates to objects (posts, page, etc). You better use usermeta - update_usermeta. E.g update_usermeta( $user_id, 'company', $company_id ); Wordpress is built by two major database tables (wp_posts and wp_users) and two (meta tables wp_postmeta and wp_usermeta). It seems that the term tables (wp_terms and others) relates to ...


0

The code below works for me in archive-product.php not sure if it may also work in taxonomy-product_cat.php EDIT I've added some lines of code to exclude posts previously outputted, since a post can belong to several categories and that's why you can find always the same posts if(is_a(get_queried_object(),'WP_term')){ $subs=get_terms('product_cat',...


0

You need to create a NEW pod that is a Category type, then simply associate it with your CPT pod.


2

The do_shortcode() function is currently in the foreach loop. I don't know what are the parameters of this shortcode , but if it accepts comma separated values of term slugs: $terms = get_the_terms( $post->ID , 'shoptype' ); $i=1; $commaSeparatedvalues=""; foreach ( $terms as $term ) { $term_link = get_term_link( $term, 'shoptype' ); if( ...


0

Same issue as the OP. As @sviriden noted in his answer, the problem is that the main query is not including your custom post type in the wp_posts.post_type IN clause. I tracked down the issue in class-wp-query.php to these lines: if ( 'any' == $post_type ) { $in_search_post_types = get_post_types( array( 'exclude_from_search' => false ) ); ...


0

First, take a look at this: https://developer.wordpress.org/reference/classes/wp_query/ You can filter by querying by post type, or in a single query (code between /* */). <?php //This is the first query $query_A = array( 'post_type' => 'post_type_A', 'post_status' => 'publish', //'cache_results' => true, 'posts_per_page' =&...


Top 50 recent answers are included