Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 504799

WordPress count post

$
0
0

Replies: 0

How can i count wordpress post. I am using custom post type UI and advanced custom field. I have created a post type called (product) and it has a fieldname called (product_family) which is a select tag and it has a 3 inside it (Latest,Car Navigation and Car Recorder).

I tried codes like this but cannot get it. How can i count the number inside of the select tag.


 $args = array(

                            'post_type'     => 'product',
                            'post_per_page' => -1,
                            'meta_key'      => 'product_family'

                            );

                $query = new WP_Query($args);

                $count = $query->post_count;

                echo '<p>' . $count . '</p>';
  • This topic was modified 5 minutes ago by  sonny12.

Viewing all articles
Browse latest Browse all 504799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>