If you were to use WP_Query to retrieve a list of posts, you can then access the number of posts using ‘found_posts’.
e.g. (from the support pages)
$query = new WP_Query( array( 'author' => 123, 'post_type' => 'posts_comcurso' ) );
Would return all posts with a userid of 123 in your selected post type. Then access the number of posts like so:
$count = $query->found_posts;
There may be other ways but the above gives you a lot of flexibility to target the posts you want to count.
Related Posts:
- How to apply order on custom taxonomy and custom meta key on custom post type
- what is the correct way to compare dates in a WP query_posts meta_query
- Redirect after deleting post and keep track of pagination
- Query posts by custom post type and custom taxonomy
- Query post types with multiple keys
- Remove POST_TYPE from custom post type permalink
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- Get all posts WHERE custom_field is LIKE value
- Custom Post Type | Fatal Error on register_post_type()
- Setting posts per page in query_posts
- How to insert content from another Custom Post type into Post?
- Get rewrite slug of custom post type in template
- How to customize a permalink (URL) structure?
- Plugin: register custom post types, child ready and performance best practices
- Display only one post each WEEK
- Conditional Query of Custom Post Type and custom taxonomy
- will post_id ever change? Can I safely use post_id for custom queries?
- Custom Post Type Query for Sidebar Doesn’t Work on Front Page
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- attach CPT data to a taxonomy
- How to insert data into meta box from another plugin?
- Convert Custom Table Data Based Plugin To Be Searchable
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Create a post automatically if search result has zero results
- Registering an optional custom post type from a plugin
- Add category slug as class attribute in a link array
- Add Excerpt On Quicksand Plugin
- Multiple Block Quotes without using HTML
- What’s the best way to show custom post types? With page template it’s not perfect!
- Inserting two categories
- Set a Custom Post Type as a Homepage
- get_edit_post_link() not working as expected when passed id in plugin
- Limit the post for differents custom post type in the same wp_query
- order by meta_value serialized array
- remove_action conditionally for Custom Post Type
- WordPress custom post action hook
- Uploaded image not appearing in custom post type
- Query for posts in 2 taxonomies
- How to make an archive page displaying posts in a date range
- How to add notification in the sidebar of the administration panel when a Custom post type is created? [duplicate]
- Display custom post types with custom date field value (before today) & order by custom date field
- How to get Custom Post ID by adding filter to child theme’s function
- Custom Post Type get_post_type_archive_link( $post_type ) returns false
- Dynamic Custom Post Type Plugin
- Remove All, Published and Trashed Post Views in Custom Post Type
- Multiple post type queries (with specific arguments for each)
- WordPress if in term*
- Custom Post Type: Upload Multiple Images
- What’s a better alternative to this code?
- Getting template_include to work when allow_url_include is off?
- Show a Category X’s custom post type on Category X archive page?
- WordPress post_where & posts_join not working only for custom post type
- Structure of data : CPT + terms
- Custom Permalink to remove category word , keeping posts permalink with date?
- Default text in a specific post type, but not visible?
- How to remove post listing page for a custom post type
- How to include term custom meta into the custom taxonomy term permalink structure
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Different Ways to Query Custom Post Types?
- How to show only the most recent post on my custom post type archive?
- Change “empty trash” button text?
- find custom post type post by searching its custom field with my string
- FacetWP paging custom wp_query
- why post_class() function apply css classes to all other files?
- Unable to format dates to put in event calendar
- Dynamic assign a custom template to custom post type posts
- Display Custom Post Types Glossary
- Custom post type in Custom widget – $listItem
- Find Posts based on Child Post value
- Limit Amount of Pages users can create in Custom Post Types
- WP 3.1 custom post type permlinks
- Showing only posts from the current user who is logged in?
- returning the currect URL for nested posts
- Why is my custom post content only viewable when signed into WordPress?
- How to add a default predefined thumbnail when creating a brand new post?
- Plugin Development using classes – Public & Private Callbacks
- Custom post type specific item design
- How can I assign multiple parents to CPT?
- Issue removing columns from admin table
- Getting 404 on child page with pre_get_posts() on custom posts
- WP REST API Custom endpoint don’t work in my plugin
- minimize wp_query call to database
- Limit posts per page depending on the size of a div?
- Delete Post by User
- Remove Custom Capability
- How to set class to “current-page” on the currently viewed single post within a CPT
- Can I override the permalink/slug on creation
- How can I list custom post by custom category?
- Custom Taxonomy Showing in WP Menu
- Query Posts From Multiple Post Types
- WP Build-In Post selector for CPT
- Hide custom post type and use its slug in new plugin menu
- How to make a template for a specific post of a custom post type?
- show custom post’s post in two different divs [duplicate]
- ACF select box css color change
- Creating post custom field text area
- How to consume external API from WordPress post editor and display the response data in the custom field?