• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

WordPress – Change Post Counts on edit.php

October 9, 2012 by Webhead

Problem

I wanted to change what posts were displayed to a user when they logged into wordpress and view the Posts page  I could easily alter what posts are shown by using the ‘pre_get_posts’ filter, but the problem was that the number of posts for each status did not change.  You know, at the top of the page it looks like: “All (5) | Published (5)”.  The number 5 did not reflect the number of posts being shown.

Solution

I was hoping to find a filter of some sort on the wp_count_posts function, but there are none.  The second best solution is to rewrite that whole line using the ‘views_edit-post’ filter where “edit-post” is the page id.  A sample of what can be done is in the link below.

 

source:  http://wordpress.stackexchange.com/questions/36117/wp-post-list-tableget-views-have-post-counts-account-for-filters
keywords:  wp_count_posts filter

Filed Under: Coding Tagged With: php, wordpress

Primary Sidebar

Topics

apache apple block editor chrome cms css debug eCommerce embed firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery linux localization mac os x ms sql mysql open source optimize php php 5.3 responsive rest api seo svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools