Create page in category using REST API

The REST docs show how to create a page:

But it makes no mention of how to set categories for that page. It is also not mentioned in the categories page (

I assume this has to be done by adding data to meta property but I can’t find an example.

How do I create a page in specific categories?

How to search WordPress Posts by Category

I’m on WordPress 5.7.2 and testing the following through the twenty-twenty-one theme.

I apologize in advanced if this question has been asked to death, but I’m having a hard time trying to find a solution for the issue. All I want from the wp-admin side is a way to search for Posts by "category name". Even if I have to add a custom hook / filter into my child theme to make this happen, I’ll do it. But is this possible today?

Right now, when I attempt to search a published post by its assigned category name in /wp-admin/edit.php?…, I get nothing back.

Thanks for any tips!

On clicking on the category name the page is redirecting on 404 pge

I have created a custom post type and added 60 posts and added each post in the category. I am able to display the post and category on the page and I am using the below code

function intelligenceList( $  atts ){   $  args = array(           'post_type' => 'intelligence',         'post_status' => 'publish',         'posts_per_page' => 70,          //'orderby' => 'title',          //'order' => 'ASC',      );    if(!empty($  _REQUEST['keyword'])){ $  args = array(   'post_type' => 'intelligence',   's' => $  _REQUEST['keyword'],   // 'meta_query' => array(   //   array(   //     'key' => $  _REQUEST['keyword'],   //     'value' => $  _REQUEST['keyword'],   //     'compare' => 'LIKE'   //   ),         // ) ); }   $  loop = new WP_Query($  args);     $  data ='';    $  data.='<div class="intelligenceList innerBox"><ul>';    if($  loop->have_posts() ) {         while($  loop->have_posts() ) {         $  loop->the_post();         $  tid = $  loop->ID;     $  calegoryList = get_the_terms( $  tid , 'intelligence_cats' );     foreach ( $  calegoryList as $  cat ) {       $  category_link = esc_attr( esc_url( get_category_link( $  cat->term_id ) ) );       $  catname=$  cat->name;         }              $  data .='<li>                 <div class="intelligenceBanner"> <img src="'.get_the_post_thumbnail_url($  tid,'large').'" alt="'.get_the_title($  tid).'" class="thumbnailPic">                 </div>                 <div class="intelligenceContent">                 <h6><a href="'.$  category_link.'">'.$  catname.'</a></h6>               <h3>'.wp_trim_words(get_the_title($  tid),9, '...').'</h3>               <p>'.wp_trim_words(get_the_excerpt($  tid),40, '...').'</p>               <a href="'.get_permalink().'">READ</a>               </div>             </li>';             }         }         else{           $  data.='<li>Sorry, no posts matched your criteria.</li>';         }  $  data .='</ul></div>'; echo $  data;   //return $  postData;  wp_die(); // it will remove 0. } 

Is there any issue with the below code? because when I click on a category then it’s redirecting to the 404 pages. I am using below code for categroy

foreach ($  calegoryList as $  cat) {           $  category_link = esc_attr( esc_url( get_category_link( $  cat->term_id ) ) );           $  catname=$  cat->name;          }       <h6><a href="'.$  category_link.'">'.$  catname.'</a></h6> 

I try to reset the permalink setting but still going to the 404 pages. Would you help me out how to hyperlink the category name?

Do I need to create the category.php page

Structured data for category pages

We run a wordpress website. Our category pages are a but different from the standard category pages. They are articles in which clusters of underlying articles are presented with some surrounding content. the links to the articles are subcategorized. I understand that "collectionpage" is the right page type and itemlist (OR haspart??) containing the references to the different articles.

My question: should I use separate itemlists for the articles per subcategory or throw all the articles referenced on the categorypage in 1 itemlist?


Access category within rss2_head hook?

Can I access the current category of a category feed with the rss2_head hook to add for example itunes tags?

Lets say I have I want to get acf field elements associated with this specific category.

Here is what I am trying to accomplish:

function itunes_head() {         $  category = get_the_category();         $  categories = get_category();         global $  post;         var_dump($  categories);         echo print_r($  post);         echo $  categories;         echo $  category; } add_filter( 'rss2_head', 'itunes_head' ); 

I am assuming that I somehow can retrieve the catx category here?

WooCommerce products sorting by primary category first

I have a site with woocommerce and yoast seo plugin. I want to list the products on category archive page, by making the products of primary category (from yoast plugin) come first. Currently it does not do that. It is listing the products randomly or by menu order. The products have multiple categories assigned. For ex. the page of ‘Fashion’ category archive should list the products with primary category ‘Fashion’ to come first. Thanks

I want to show the category image (set with ACF) inside a loop that shows it inside the cards, how can I do it?

<?php get_header();   $  category = get_category( get_query_var( 'cat' ) ); $  cat_id = $  category->cat_ID;  $  id_cat = array('parent' => $  cat_id); $  categories = get_categories( $  id_cat ); 

// Get particular category’s object info. $ queried_object = get_queried_object();

// (Optional depending on desired outcome) If you wanted to get the type of taxonomy. $ taxonomy = $ queried_object->taxonomy;

// (Optional depending on desired outcome) If you wanted to get the associated ID. $ term_id = $ queried_object->term_id;

// Get image ID for this field. $ attachment_id = get_field( ‘category_image’, $ queried_object );

// URL of image at specific size. $ image = $ attachment_id[‘sizes’][‘chosen-image-size’];

<section class="p-5">     <div class="container">         <div class="row text-center">             <h3><?php single_cat_title(); ?></h3>             <p><?php category_description(); ?></p>         </div>     </div> </section>  <section>     <div class="container animated">         <div class="row d-flex" data-masonry='{"percentPosition": true }'> 

‘.’ term_id ).'”>’ .$ category->name.”.’ ‘; } ?>

In evidenza

            <?php while(have_posts()): the_post(); ?>                 <div class="col-6 col-md-4 col-xl-3 mb-4">                     <div class="card text-center">                         <a href="<?php the_permalink() ?>">                                         <!-- Immagine Articolo -->                             <?php if(has_post_thumbnail()): ?>                                   <div class="m-1"><?php the_post_thumbnail('thumbnail') ?></div>                             <?php endif; ?>                         </a>                             <div>                             <h3><?php the_title(); ?></h3>                             <p><?php the_excerpt(); ?></p>                         </div>                         <a href="<?php the_permalink() ?>" class="btn btn-outline-dark btn-sm">Continua a                             Leggere</a>                     </div>                 </div>                     <?php endwhile; ?>                     <?php else: ?>                         <?php echo wpautop('ops.. non ho trovato nulla');?>                     <?php endif; ?>         </div>     </div> </section> 

How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?

On the Edit Screen in the WP Admin there is a meta box for WP’s built-in Category taxonomy. This meta box is built using post_categories_meta_box() (/wp-admin/includes/meta-boxes.php).

This meta box uses wp_popular_terms_checklist( $ tax_name ) and wp_terms_checklist( $ tax_name ) to output the actual categories (with checkboxes) within the meta box.

wp_terms_checklist() (wp-admin/includes/template.php) uses the Walker_Category_Checklist (/wp-admin/includes/class-walker-category.checklist) to build the categories/checkboxes.

Walker_Category_Checklist inherits from Walker (wp-includes/class-wp-walker.php) just like a number of other WP walkers (Walker_Nav_Menu, Walker_Comment, Walker_Category, etc.).

When extending the Walker_Nav_Menu we can hook into the wp_edit_nav_menu_walker filter and return our custom walker. Is there a way to do this with Walker_Category_Checklist?


Update 1:

I see in wp_terms_checklist() there is:

apply_filters( 'wp_terms_checklist_args', $ args, $ post_id );

I’m thinking that I can hook into this filter, change the walker argument to a custom walker and that this may do the trick?