Rename Default Category (Uncategorized) Via a Function
I think wp_update_term should do the trick: wp_update_term(1, ‘category’, array( ‘name’ => ‘A Real Category Name’, ‘slug’ => ‘real-category-name’ ));
I think wp_update_term should do the trick: wp_update_term(1, ‘category’, array( ‘name’ => ‘A Real Category Name’, ‘slug’ => ‘real-category-name’ ));
There is no default way to sort terms randomly. There are ways to do this using php. First, you’ll need to remove the number argument from get_terms. As your code currently stands, you are getting 5 terms and shuffling them around. For this to work, you’ll need to retrieve all the terms from your taxonomy, … Read more
What you can do is to set up a pre_get_posts() filter in the subdomains’ theme functions.php file to restrict posts to the desired category… function my_subdomain_category( $query ) { if ( $query->is_main_query() ) { $query->set( ‘cat’, ‘123’ ); // use the categoryID for space or products } } add_action( ‘pre_get_posts’, ‘my_subdomain_category’ );
There is only one default term in WordPress, that is the term uncategorized from the taxonomy category. This term is created when WordPress is first installed. This term’s ID will always be 1 if it is not altered in any other way by some custom code from a custom theme or plugin. Term ids, like … Read more
I haven’t run this code so there may be a syntax error, but the gist is to return userfeed-taxonomy with the terms specified that have featured category OR cities-taxonomy with the terms specified and featured category OR anything else that’s not those taxonomies. It’s kind of clunky, maybe there is a better way: $query->set( ‘tax_query’, … Read more
Too bad no-ones answered you on this simple question. I guess you’ve allready figured it out, but for anyone else wondering the same: A WooCommerce Slug is the true path to a certain category/product the database uses to find the correct category/product (just like on a computer: usr:\\My_Computer\Desktop\ or c:\\programfiles\desktop\), and can often be seen … Read more
Here is the solution for your Question: Please check this one, I hope it will help you to display child category details. $taxonomy = ‘product_cat’; $orderby = ‘name’; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes, … Read more
Try this code, not much different from your’s but with proper nesting. Let me know if that works. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <a href=”https://wordpress.stackexchange.com/questions/212425/<?php the_permalink() ?>” class=”noborder”><?php if ( has_post_thumbnail() ) { the_post_thumbnail(‘thumbnail’); } ?></a> <a href=”<?php the_permalink(); ?>” … Read more
CHRISTMAS EDITION Due to Christmas time and my brain hitting some serious technical difficulties, I got get_the_category() and get_the_categories filter mixed up. Here is the revised filter function, working: You can also make use of the get_the_categories filter add_filter( ‘get_the_categories’, function ( $categories ) { // Only return the first object in the array return … Read more
As the core tickets (for example https://core.trac.wordpress.org/ticket/16734) say the point of the api is to provide a dropdown and not a multiselect. IIRC in the quick edit of posts no API is being used for the category and tags multiselct. In other words, just ignore the API and write your own.