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.
1,423 questions
0
votes
1
answer
18
views
Allow HTML in custom taxonomy description, and show it on front end
Sorry I'm quite new at coding, and also working with WordPress and ACF, and I'm trying my best but I can't figure this out:
I'm trying to load my taxonomy description in rich text. Currently I'm using ...
0
votes
1
answer
17
views
Is there a way to edit non-custom term attributes?
I have a custom post type (FAQs), taxonomy (FAQ Categories) and everytime I want to create one it appears all the same name, slug, parent, description fields. I was wondering... If there is a ...
0
votes
1
answer
29
views
Can't retrieve custom post type taxonomy term to custom post type editor
I have 2 main problems:
I can't seem to add editor_name custom field to default/native WordPress list of request URL query parameters.
This is the request WordPress is using:
http://localhost/wp-...
0
votes
0
answers
22
views
Put ACF function output code the_terms
I would like to put an ACF field in the of my the_terms function, is this possible?
Because I can't figure out how to put it.
<?php $dev = get_field ('my_field', 'option');?>
<?php ...
0
votes
1
answer
104
views
Modify WordPress Search
I'm facing a challenge with a WordPress project and I would appreciate the community's help in solving it.
The issue lies with the search functionality. When customers type in a search term, such as &...
0
votes
0
answers
23
views
Issue with WordPress Automatically Assigning Terms to Multiple Posts
Hello WordPress community,
I'm encountering an issue where WordPress is automatically assigning newly created terms to multiple posts in my installation. When I create a new term (custom taxonomy: ...
1
vote
2
answers
56
views
Retrieve only terms that are in use
I'm currently using term_exists( $term, $taxonomy ); in a conditional, but the problem is that it includes terms that are not being used (although they exist in the list of categories).
Is there ...
0
votes
0
answers
98
views
Set Variant options/attributes values on WooCommerce
I can insert variant options/attributes with no default values(variant name) in order to display following Variant options area with selected attribute names(Renk,Beden) on the product,
by using ...
1
vote
0
answers
22
views
When using get_terms with hide_empty = true, terms that only contain scheduled posts are not returned. How to override this?
My code is simply:
$cats = get_terms(
[
'taxonomy' => 'category',
],
);
Obviously, hide_empty is true by default. There's a category that only contains scheduled posts and it's not ...
0
votes
1
answer
52
views
How to filter the terms of custom taxonomy by author id in admin panel
I created custom taxonomy named 'Customers'.
In admin panel, different users will login and create their Customers in that taxonomy.
I want to show them their own Customers only. Currently they can ...
0
votes
0
answers
70
views
Search and filter terms of a custom post type only and display results
I am creating an archive-newsroom.php for my /newsroom page and custom post type. I have the custom post type working, but now I am trying to have a search input to display the custom post type ...
0
votes
1
answer
34
views
Overriding an existing filter
There is this function that is part of the plugin EasyDigitalDownlaods' plugin:
public function category_dropdown( $name = 'edd_categories', $selected = 0 ) {
$categories = get_terms( '...
0
votes
0
answers
24
views
Get a custom post type's taxonomy type term names displayed as checkboxes and filter
I using this code to get all the taxonomies associated with a custom post type "newsroom"
$post_type = 'newsroom';
// Get taxonomies associated with the custom post type
$taxonomies = ...
1
vote
1
answer
110
views
Using same term for slug and category
I am having problems with a site that uses the category “vacatures” for posts. The “Vacatures” page, lists those posts.
Some time ago the client has made a page called “vacatures” and replaced the old ...
0
votes
1
answer
134
views
get_term does not return the term
I am using my own taxonomy which has in the table terms corresponding row with a term. I need to get the term by term_id using get_term(141) but i get error invalid_taxonomy. I think that the ...
0
votes
1
answer
385
views
Create a custom taxonomy's term form
i would like to remove/hide the term form in the edit-tags.php page because i need to move it on another page.
Is that possible somehow?
Thanks
1
vote
1
answer
102
views
Term meta not saved when adding the first category
I'd like to give administrators and editors the option to specify colors for categories they create. They'd enter in the hex colors they prefer e.g. #000.
I'm experiencing an odd issue in that the ...
0
votes
2
answers
29
views
Taxonomy Archive URL + Template
Working on an WP build with custom post types & taxonomies
Taxonomy = Reviews
Example terms = nes, snes, gamecube
I've got a taxonomy archive page, taxonomy-reviews.php
Going to the url /reviews/...
1
vote
0
answers
35
views
How to make a term belong to multiple taxonomies?
As the title says, I’d like to implement a system where I’d like to have a term belonging to multiple taxonomies.
Just in case someone’s wondering “what on earth does he need this for?”, hear me out. ...
0
votes
1
answer
106
views
How to display First level child terms of current term's parent taxonomy?
I want to display only the first level of children of the taxonomy useing get_terms(). For example, I want to display web design,web develope, web ....
My terms:
programing
-Web
--web design
---html
--...
0
votes
2
answers
435
views
How do I check if a post has a term with a particular ancestor/parent?
I'm trying to show a message on a product if the user is logged in, and the product is in the chains category, but I have assigned children/grandchildren of that term, not chains itself, and I don't ...
1
vote
0
answers
38
views
Unable to import term_meta in wordpress using wp_cron
I have imported cities as term named as sf-cities I'm trying to add countries name as term meta I have attached sample of my code.
add_action( 'event_notification', 'import_countries', 10, 0 );
...
0
votes
0
answers
224
views
Hide empty categories on widget
I excluded some products from woocommerce_product_query with this code:
function en_archive_products_by_rol( $query ) {
if (is_admin()) {
return;
}
$meta_query = (...
0
votes
1
answer
213
views
How can I replace the values in WP_Term?
WP_Term outputs:
WP_Term Object
(
[term_id] => 3
[name] => Public
[slug] => public
[term_group] => 0
[term_taxonomy_id] => 3
[taxonomy] => category
[...
4
votes
1
answer
200
views
delete_term is not working properly with add_action()
delete_term is not working, I'm trying to delete term and after I deleted it, it'll also delete the similar term from different a taxonomy based on their slugs
here's my code of the delete_term, so in ...
0
votes
1
answer
387
views
Rewrite rule taxonomy url with different values in one function
So I'm a little bit stuck here and honestly don't know how to proceed, I'm trying to do a rewrite rule to a series of specific urls
I have a movies custom post type and an alphabet taxonomy and the ...
2
votes
1
answer
77
views
WordPress Two Level Filters on Getting Custom Taxonomy Terms
I have a Custom Post Type Called movie and I have two taxonomies genre and quality associated with that.
Now I need to get/filter all terms IF
genre = 'action'
AND
quality = 'HD'
Using this code I ...
3
votes
1
answer
456
views
How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
I have the following SQL query:
SELECT t.name FROM wp_posts p
INNER JOIN wp_term_relationships tr ON tr.object_id = p.id
INNER JOIN wp_terms t ON tr.term_taxonomy_id = t.term_id
WHERE p.id ...
0
votes
0
answers
27
views
How to use wp_set_object_terms depending on page ID?
The function to set custom term works fine.
add_action( 'save_post', 'set_custom_term', 30, 2 );
function set_custom_term( $post_id, $post ) {
wp_set_object_terms($post_id, 'guitar', 'instrument',...
-2
votes
1
answer
184
views
How to get tags only with custom meta field and display them randomly?
I'm trying to have a function to display only the tags with custom meta field tax_image_url_universal and display them randomly, which means when page reloads different tags to be displayed.
Currently ...
0
votes
1
answer
385
views
How can I filter get_terms with post meta
I have a custom post type product with custom taxonomy web_cat and I have set a custom field expiration_date to each of the posts of this type. I'm using that field in a pre_get_posts to hide posts ...
0
votes
1
answer
47
views
List posts grouped by children of a custom taxonomy
I am successfully listing posts grouped by category from a custom taxonomy like so:
Category 1
Post
Post
Post
Category 2
Post
Post
Post
Category 3
Post
Post
Post
Category 4
Post
Post
Post
I am ...
0
votes
1
answer
946
views
cannot create product attribute (taxonomy) and add terms on the same execution
I have the following functions to create a global product attribute and populate it with terms based on data from an API.
protected function getOrCreateAttribute($slug, $name)
{
$...
0
votes
1
answer
438
views
get_terms of specific parent (including the parent itself)
The title is self-explanatory, but let me say a word on this...
I want to get the terms of a specific parent, but also include the parent itself in the returned terms. I tried something this $args['...
0
votes
1
answer
264
views
get_the_terms inside save_post gives old terms
When I use get_the_terms inside save_post, I get the old taxonomy terms.
This is something that I would expect from pre_post_update, but why does it happens to save_post ?
And, more important, how to ...
2
votes
1
answer
638
views
How to detect if an ACF custom-field is really in use?
I want to find out if a custom-field is in use for a post or term.
That means the custom-field has a content and is not empty.
I guess that's more difficult for selects, radio or checkbox-inputs.
So ...
0
votes
2
answers
116
views
Unable to do WP_User_Query with meta filter
I have a user base of hundreds of users, and trying to create a custom API endpoint to get users in a specific membership group.
The database structure is as follows (using Ultimate Member plugin):
...
0
votes
1
answer
15
views
WordPress emails error regarding the argument type even if the type is correct
function test_sort_terms_hierarchicaly( Array &$cats, Array &$into, $parentId = 0 )
{
if ( is_array( $cats ) ) {
foreach ( $cats as $i => $cat ) {
...
0
votes
1
answer
277
views
Get access to all terms associated to each post that the wp_query loop displays
If the following loop logic gives me access to post properties that are associated to a CPT (for example, 'sports')...
$args = array(
'post_type' => 'sports',
'posts_per_page' =&...
0
votes
0
answers
46
views
Create taxonomy terms from custom field values
I have a CPT 'Candidates', where its custom fields are being fetch from an API.
I am planning to convert/associate the values of these custom fields as taxonomy terms. Because I need to filter the '...
0
votes
1
answer
229
views
wp_set_object_terms setting only first id from array
Why would wp_set_object_terms save only the first value from an array?
I'm using a frontend form to programmatically create a Woocommerce product. The frontend form uses a multiple select field that ...
0
votes
0
answers
41
views
Include get_term_link inside search
I am trying to include custom taxonomy links inside the search.
This is my code that gets the links of my 'help_cat' taxonomy, but I am struggling on how to add/include this inside the search.
...
2
votes
1
answer
266
views
get_terms_args ordering by meta key not working
I have a custom taxonomy called "edition". Each edition has a meta key "_edition" that stores an incremental number from 1 to N. So, if I have an edition called "Edition 13&...
0
votes
2
answers
180
views
What is the purpose of the "term_id" column in the "wp_term_taxonomy" table?
The table below shows some example rows from a "wp_term_taxonomy" database table. Notice that values of the "term_taxonomy_id" and "term_id" columns are exactly the same. ...
0
votes
0
answers
52
views
Cannot retrieve categories for post in The Loop
add_filter('the_title', 'filter_title_add_post_category');
function filter_title_add_post_category($title) {
global $post;
$debug = '';
if (
is_single()
&&...
0
votes
0
answers
144
views
WP-CLI Add category as menu item main-menu
I've found this documentation about adding terms using WP CLI: https://developer.wordpress.org/cli/commands/menu/item/add-term/ and tried to find out how I can add an existing category to the main-...
0
votes
1
answer
854
views
Can't get term id for category archive
I am trying to get the term_id of the current category archive.
On the category archive, when I var_dump($wp_query)
object(WP_Query)#1189 (55) {
["query"]=>
NULL
["query_vars&...
0
votes
1
answer
223
views
Trash Bin for Categories?
I have a cat_notice taxonomy, where there are several categories and one of them the slug is 'trash'. In this case I created a link and I needed that when I clicked on this link I would take the ...
0
votes
1
answer
630
views
update_term_meta not working
I am trying to remove a string off of a bunch of slugs in terms from a CPT taxonomy.
For example, I have a term named "Accounting" but the slug has the "accounting-expert-witnesses"...
0
votes
1
answer
218
views
get value from 'terms' table
so I feel like I am missing something very obvious, but I need to get a value from the database table 'terms', and it seems get_terms fetches from taxonomy table. I've tried get_term_by as well but to ...