How to make all post in to a category?

First query all post $args = array( ‘post_type’ =>’posts’, ‘post_status’ =>’publish’, ‘posts_per_page’ =>-1 ); $query = new WP_Query($args); $post_ids = array(); if($query->have_posts()){ while ($query->have_posts()){ global $post; $query->the_post(); array_push($post_ids,$post->ID); } } Now you have an array called $post_ids which contains all post’s id . Now , change the categories Loop through the array and change the … Read more

Display Taxonomies in loop with template args

The simplest solution: echo get_the_category_list( ‘, ‘ ); Following your way: Change your $args like so: $args = array( ‘template’ => ‘%2$l’, ‘term_template’ => ‘%2$s’, ); And then, add this to your functions.php file (this will affect all %l markers!); add_filter( ‘wp_sprintf_l’, function($templates) { // $templates[‘between_last_two’] = sprintf( __(‘%s, and %s’), ”, ” ); // … Read more

Inserting categories as a hierarchical terms from frontend form

Use wp_set_object_terms( $object_id, $terms, $taxonomy, $append ); to get this done. You are adding everything with add_post_meta which will not add category to your post type. wp_set_object_terms( $post_id, sanitize_text_field($_POST[‘some_field’] ), ‘schooltype’, true ); But here I am also not sure how to assign parent-children relationship via wp_set_object_terms, even it’s not mentioned on WordPress codex! I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)