Show message if term slug changed
Show message if term slug changed
Show message if term slug changed
The problem is that there may not be a current user when that cron job runs. so you need to check if there is a logged in user, save their ID if so, then set the current user to whatever ID has the correct capabilities, do your stuff, then set it back to whatever it … Read more
Why is the category item count not updating after assigning a category?
nmr, thanks for your suggestion. So finally had a chance to go back and do some more testing. Using your suggestion, I realized that I was missing a custom capability for my custom taxonomy. Not sure what happened to it as everything was working before my update to 5.1.1 but anyway, I found the one … Read more
You are specifying the same slug of lyrics for both your custom taxonomies. WordPress by default cannot share the same slugs for two taxonomies due to WordPress’ rewrite API. Which caters for the default nature of posts, archives, taxonomies, slugs and the WordPress template hierarchy. To prevent your 404 errors you can change your artists … Read more
The way you are doing it, you can’t. You would have a do a manual query for exactly what you want. global $wpdb; $query = “SELECT ‘name’, ‘slug’ FROM wp-term_taxonomy WHERE …”
So if the “country” field is a taxonomy field with a single value (i.e. the field’s Appearance is radio buttons or a single-selection select/drop-down menu), and you want to display the term name, then you could use the get_term_field() function in WordPress: <li><?php echo get_term_field( ‘name’, get_field(‘country’) ); ?></li> Or using get_term(): <li><?php $term = … Read more
To limit the results to the children of the current product category, you can use parent parameter in get_terms(). The id of the current category, to be set as the parent value, will be get using get_queried_object(). $term_id = 0; $queried_object = get_queried_object(); // // check if it’s a custom category if ( $queried_object instanceof … Read more
wp_insert_post not adding taxonomy (using wp_set_object_terms)
I found this and it works. Shout out to WP Munchies! https://wpmunchies.com/display-primary-category-using-yoasts-make-primary-feature/ <?php // Fill in your custom taxonomy here $yourTaxonomy = ‘CUSTOM_TAXONOMY’; // SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY $category = get_the_terms( $postId, $yourTaxonomy ); $useCatLink = true; // If post has a category assigned. if ($category){ $category_display = ”; $category_link = ”; … Read more