How to assign posts without any category to the default category

You can use wp_insert_post like this: $my_post = array( ‘post_title’ => ‘My post’, ‘post_content’ => ‘This is my post.’, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_category’ => array(8,39) ); // Insert the post into the database wp_insert_post( $my_post ); Ref: https://codex.wordpress.org/Function_Reference/wp_insert_post use wp_update_post to update posts.

Displaying Categories and Sub Categories

You can achieve categories and sub-categories this way. <?php $list_categories = get_categories( $args ); echo “<div class=”container”>”; echo “<div class=”productsubmenu”>”; echo “<ul>”; foreach ($list_categories as $cat) { if($cat->category_parent == 0) { $category_id = $cat->term_id; echo ‘<li class=”parent ‘.$my.’ “><a href=”‘.get_term_link( $cat ) . ‘”>’.$cat->name.'</a>’; $args2 = array( ‘taxonomy’ => $taxonomy, ‘child_of’ => 0, ‘parent’ => … Read more

Show category to visitors in different name or different language without changing basic category

You need to make your category name translation ready. You can do so by using WordPress functions such as __(‘Your category’,’your-text-domain’), _x(‘Your Category’, ‘your context’, ‘text domain’) and more click here. After that, you can use poedit or other tool to extract translatable strings form your code and create your_locale.po file which contain your custom … Read more