A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [terms]

In WordPress, terms are itens set to a taxonomy, i.e. when you create new categories or tags you create new terms.

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

Issue updating categories

When post is saved (not real time toggling). The list of locations category isn't displayed correctly function assign_parent_terms($post_id, $post) { $temp_taxonomies = get_post_taxonomies($post);...
1
vote
1answer
25 views

Wordpress Related Post by tags in Single.php

I want to create a related post, but the code I tried shows only related post using only the first tag. I want related post which use all tags. (Because my site is a blog and each post can have up to ...
0
votes
1answer
29 views

Get taxonomy term by slug in post on archive page

I have a registered a custom post type called "projects" and assigned a taxonomy called "disciplines". Here's how it looks: <?php // Register projects cpt function projects() { $labels = array(...
0
votes
1answer
29 views

List taxonomy term slugs within shortcode (do_shortcode)

I'd like to list the taxonomy terms within my shortcode. This is how I get the list of terms (separated by commas): <?php $terms = get_the_terms( $post->ID , array( 'shoptype' ) ); ...
0
votes
0answers
13 views

Load Taxonomy terms based on Post Type selection

I am creating a widget.I want to get Taxonomy Terms with the selection of Post Type in dropdown list. When a Post Type is selected from dropdown list, the related Terms/categories of that Post type ...
0
votes
0answers
14 views

Get categories within specific term

I have a WooCommerce shop, where I'd like to show every possible product category, where the products have a specific attribute (term). Say I have a product attribute called: "Designer", then I wish ...
0
votes
0answers
8 views

Get name of all term which is duplicate using Mysql

I am coding something to get all duplicate term which has duplicate name using MySql query. The issue I have currently is I am getting the records in a single occurrence I need all data which has same ...
0
votes
1answer
19 views

Show template part if part of term

I'm not an educated programmer, but usually i can put existing code together so it works the way i want it to. But this time i'm lost, i feel like i've tried everything. I'm trying to only show a ...
0
votes
1answer
35 views

Get WooCommerce product category list in functions.php

I am trying to create a an array of WooCommerce product categories to use as a dropdown in the Customizer. The following code is working in a function hooked to 'customize_register' but not in ...
1
vote
0answers
17 views

Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish

I have two Custom Post Types called book and publisher. The book has two Custom Fields (Metabox) author_fname and author_lname and the publisher has a Custom Taxonomy called authors Now can you ...
1
vote
1answer
19 views

Function get_queried_object() return NULL in custom taxonomy

Hi i need get term ID from custom taxonomy but it is always NULL. taxonomy-galerie-kategorie.php <?php /** * A custom taxonomy template for gallery. */ ?> <?php ...
1
vote
0answers
24 views

Get random out from get_terms()

I am trying to get Random terms from function "get_terms()", even though. I have found here this answered before and marked it as the best answer, But looks like that's not working anymore.
0
votes
0answers
32 views

get_queried_object not work in taxonomy page

I am trying to display post count by month of current custom taxonomy in custom taxonomy page. but it display total count by month <?php $post_type = "tesekkur"; $posts = get_queried_object()->...
1
vote
1answer
39 views

How to dynamically add custom taxonomy terms as a sub-menu of an existing menu item, using custom walker class

Desired outcome I have a custom post type and belonging to it, a custom taxonomy. I'm trying to get my child theme dynamically add the terms belonging to that taxonomy as a sub-menu under a certain ...
1
vote
1answer
20 views

Why “Warning: Invalid argument supplied for foreach()”

The following code gets the "organisation" taxonomy terms associated with the last 20 "article" or "viewpoint" posts. First, it gets the posts, $recent_posts. Second, it pushes each of those "...
0
votes
1answer
26 views

get_the_term_list( get_the_ID() label formatting?

is it possible to change the style of the "label" of the result of a get_the_term_list( get_the_ID() ? $film_tags = get_the_term_list( get_the_ID(), 'film_tags', 'Tags: ', ', ', '' ); is there a ...
0
votes
1answer
36 views

How to print term name inside wp post loop

I have 3 different taxonomies in a custom post type. I want to print all posts with term name with them. for example: taxonomy 1 =>taxonomy=banks&post_type=creditcards taxonomy 2 =>...
0
votes
1answer
28 views

Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop

I'm looking for a way to check if (whilst outside the loop) the current user.. 1. is logged in 2. has a post published 3. their post has any term/terms from a custom taxonomy I have this so far... &...
0
votes
0answers
15 views

How to get and then style the Current Active link?

Hey there commumity this is my first question as a dev. I have made a list of the categories that are inside my custom post type by quering them. The problem is that I cant find a way to keep which ...
1
vote
0answers
16 views

Post count by month of taxonmy term

Can anyone help me please. i want to show custom post type count by month of taxonomy in archive page for current year. Example: January 24 February 43 March 5 April 6 and etc
0
votes
1answer
17 views

How to create a non removable taxonomy term?

I have this question but it refers to frontend How can make an unremovable term in the backend similar to uncategorized? Thought it could be renamable I believe the slug or ID will remain the same. ...
0
votes
0answers
14 views

Getting the next/prev post in the same last taxonomy term

I have a custom taxonomy 'offline' custom post type 'lessons' and every post has multiple terms offline >> term 1 >> term 1.1 >> term 1.2 >> term 1.3 >> post and I ...
0
votes
0answers
9 views

Taxonomy term hierarchy to work with single post as well as taxonomy pages

I have a website which has a CPT of products and product categories with subcategories. I want the url sctructure for taxonomy pages and single pages to follow url/products/term/single-product and url/...
0
votes
0answers
13 views

How to quickly fix duplicated term slugs in hierarchical taxonomies?

my problem is that I've imported in wordpress some hundreds of terms of a custom taxonomy, from another system, in 5 languages. I've found out those terms have sometimes duplicated slugs, and they're ...
1
vote
2answers
30 views

get_terms <select> <option> adds slaces to the resualt

If I run this code I get the desired result <?php $terms = get_terms( 'call-type' ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { echo '\''...
0
votes
0answers
11 views

Changing the name of an existing taxonomy option

I currently have a Taxonomy of Dates. However, I need to update the list of dates from the taxonomy to new dates for next year. How can I change the existing terms without having to create new ones ...
0
votes
0answers
27 views

Tags do not work

I can’t figure out how to add tag support to this code. Absolutely all posts are displayed on the tag page <?php $args = array(); $cat_id = ""; $queried = ...
0
votes
2answers
36 views

Order custom taxonomy hierarchy

I have some custom taxonomy for regions. Commonly it would look something like this. USA (parent) - Arizona (child 1) - - Phoenix (child 2) however, there will be cases where it will only be like ...
0
votes
1answer
68 views

I want to get term by term_name without taxonomy

Can I get the term by it's id without knowing to which taxonomy it belongs? I have a meta field that stores term names, but doesn't store the taxonomy. However, all the get_term() function have ...
0
votes
1answer
15 views

Is it possible to take a new visitor to the site to a disclaimer page and then return them to their previous page?

I am new to WordPress and I am looking to add a disclaimer page where they either "Agree" to some terms/conditions or "Do Not Aggree". When a visitor to the site enters, they are taken to the page ...
0
votes
0answers
23 views

SQL. Select category descendants

How does Wordpress fetches subcategories for a given category? I tried to figure it out from the code, but I have not succeeded. My real question is: is it possible to make some recursive sql query ...
1
vote
1answer
42 views

Order wordpress taxonomy parent terms by their children count

I need to order parent terms by their children count: function sort_terms_by_children_count ( $terms ) { $sort_terms_by_children_count = array(); foreach($terms as $term) { $count = ...
1
vote
1answer
25 views

Query all posts of a custom taxonomy term

I am using this code on single.php, This query working well but when post has parent term (that parent also have child terms) this give output all posts of parent & children But in this condition ...
1
vote
1answer
49 views

How to get woocomerce attributes thumbnail in PHP? [closed]

I'm trying to get all atribute names and images(thumbnails?) to print them , I've managed to get their names , but not the url of the image I can't find it . To add an image to woocommerce attributes ...
0
votes
1answer
29 views

Change the term based on the value of a $variable using wp_update_post in submitting a form

Background I am using a fronted form to submit data to a meta box by use the wp_update_post to a custom post type (call) with a custom taxonomy (call-type). It then also updated the terms and ...
1
vote
0answers
28 views

How to get original custom taxonomy slug after the slug has been rewritten?

I'm writing ajax handling for a theme. I'm trying to get term and taxonomy slugs from a link I click. The link is being passed with jQuery to PHP for further processing. Let's say my custom taxonomy ...
0
votes
0answers
26 views

WC attributes and terms cannot be added with the first pass of the script

In general, I am trying to insert/update post of type 'product' with attributes and terms into tax_input. It does not happen as expected. Firstly I tried to use wp_insert_post with 'tax_input' key ...
0
votes
0answers
34 views

How to replace wp_ajax_add_tag() error notice on create_term?

I am writing a plugin which uses natural language processing and knowledge graph technology to determine the true entity type of terms added to WordPress, with the purpose of tidying up taxonomies. ...
0
votes
0answers
37 views

How to display a WordPress notice on create_term action

I am hijacking create_term to do stuff when a new term is created... // Fire the function when new term is created add_action( 'create_term', 'process_term', 11, 3 ); function process_term($term_id, ...
0
votes
0answers
44 views

Exclude Specific Product Category for showing up in its parent category page

I am displaying a list of product sub-categories in a grid format in the parent Categories. There is a specific category with id 7000 which I want to exclude from the grid. How do I accomplish this? ...
0
votes
0answers
29 views

Get records for specific taxonomy only

Currently this code is displaying all records for all taxonomies but I only want to display the records for the specific taxonomy that the user clicks into, so I think I need to filter by slug or get ...
0
votes
1answer
34 views

Maintaining strict one-to-one association between terms and custom posts

I'm building an inventory system where inventory items have their own page but where standard WordPress post post types can also be tagged with these inventory items. As far as I understand, this ...
0
votes
0answers
62 views

Filter custom post by taxonomy term

I try to implement filters for the custom post type. I created the container with buttons which represents all used categories: <?php $terms = get_terms( array( 'taxonomy' => '...
0
votes
0answers
40 views

get_the_terms child terms for current post/custom post only

Inside a Post / Custom Post type loop, I am trying to get child terms selected on the edit screen of that post/custom post. For Example: Zoologist ( Parent ) Pre Zoologist Post Zoologist Now if ...
0
votes
0answers
31 views

Count tags for current post and save into custom meta field (and update it on post edit)

This question is sort of a follow up from another question on here Order posts by tags count? The first comment recommends counting the number of tags and saving it into a custom meta field. Going ...
0
votes
0answers
20 views

I am trying to set post terms to a custom taxonomy

I have a custom taxonomy that I would like to update on posts using a PHP function. An example of what I am trying to achieve is the following: Array ( [0] => WP_Term Object ( ...
0
votes
0answers
17 views

Determine if Post is between date range, and set Season #

I have a Post type called Entries, and a custom Taxonomy called Season. Season has meta Beginning Date and End Date. I'm working on a function that automatically sets the Season number based on the ...
0
votes
1answer
24 views

I can get posts in all categories. But I want to get the custom post type I created

i created custom post type ('Ürünler') with some plugin. And I want to pull all posts from here with category titles. My code doesn't see the custom post type. I'll be happy if you can help me. $...
0
votes
0answers
47 views

Trouble adding custom featured image for custom taxonomy TERMS

Wordpress version 5.2.2 Local development - WAMP PHP version 7.0.1 I am building car dealership website. Goal: Set featured image for custom taxonomy - Body Types Set featured image for custom ...
0
votes
0answers
35 views

Order by terms for specific custom taxonomies

I am using the following code to try and order property listings by state for For Sale and Sold custom taxonomy terms $terms = get_terms( 'state' ); // $terms = get_terms( array('status', 'state' ...