Counter of posts ever posted – even deleted ones
Depending on your needs, WP Query may not work for this since it won’t include posts that have been deleted after the trash has been emptied. This should work (but hasn’t been tested): function wpse_custom_post_type_counter() { $number = get_option( ‘wpse_custom_counter’ ) ? absint( get_option( ‘wpse_custom_counter’ ) ): 0; $number++; update_option( ‘wpse_custom_counter’, $number ); } add_action( … Read more