how to print total number of posts filtered by category?

I think this will do foreach((get_the_terms($post->ID, ‘project_category’)) as $term) { echo $term->term_id, ” -> “, $term->count, ‘<br>’; // if post assigned to more than once category you will have multiple lines } Basically get_the_terms call already returns term object, so you can access all properties, including count

Get 5 most recent categories

Okay, seems like this is not supported out of the box. At least I didn’t find any arguments you can use for WP_Term_Query (which is the function used behind get_categories()). So I had the following idea retrieve all categories get latest post from each category save category id & post date in an array order … Read more

When post is Published, insert into custom table a number – custom post type

Take a look at WordPress’ Post Status Transitions hooks: https://codex.wordpress.org/Post_Status_Transitions If you’ve added proper debugging (so that you die at the top of your hooked function) it sounds like you’re not hooking into the right action. Since you’re adding some meta and checking for it to see if you should run again, you could hook … Read more

I need show posts by customer (Shortcode)

First get all data using $all_posts = get_posts( array( ‘meta_key’ => ‘user_name_key’ ,’meta_value’=>’your selected name from widget’) ); foreach($all_posts as $post ){ //add data whatever you want to display on website widget }

Clean up customize_changeset in DB

No, there is not a way to disable customize_changeset posts from being created. These customize_changeset posts are created with the auto-draft status in the same way that a post gets created with the auto-draft status whenever you click on “Add New” in the admin. Note that because the auto-draft status is used, any such posts … Read more