I have created a CPT using register_post_type with the following args:

  "label" => $aLabels['name'],
  "labels" => $aLabels,
  "description" => "",
  "public" => true,
  "publicly_queryable" => true,
  "show_ui" => true,
  "show_in_rest" => false,
  "rest_base" => "",
  "has_archive" => true,
  "show_in_menu" => true,
  "exclude_from_search" => true,
  "capability_type" => "post",
  "map_meta_cap" => true,
  "hierarchical" => false,
  "rewrite" => array("slug" => $slug, "with_front" => true),
  "query_var" => true,
  "menu_icon" => site_url('/wp-content/uploads/icon.png'),
  "supports" => array("title", "editor", "excerpt", "custom-fields"),
  "taxonomies" => array('court', 'rating', 'categorisation'),

Everything works perfectly except pagination on the first page of the admin post list i.e.


does not display at all.

From page 2 onwards, it is perfect.


I have Googled the world and can’t find a similar problem, never mind a solution! Can anyone make a suggestion?

  • Any plugins/themes interfering?
    – birgire
    Sep 12, 2017 at 8:45
  • Thanks for having a look, but unfortunately, that's not it - tried with Twenty Fifteen and only the plugin which creates the CPT.
    – NettSite
    Sep 13, 2017 at 10:18
  • Strange, does the cpt slug matter? Any errors? Does it work for other post types, like post and page?
    – birgire
    Sep 13, 2017 at 13:48
  • Extra strangeness - I checked pages and posts, and pages work fine, but posts have the same issue as the cases (the CPT). If I deactivate the cases plugin, posts work fine, so there is clearly something wrong with my plugin.
    – NettSite
    Sep 14, 2017 at 15:14
  • Yes sounds like the plugin is causing it, but it's hard to say what it is.Try e.g. to remove stuff from it (in small steps) until it works again?
    – birgire
    Sep 14, 2017 at 16:41

1 Answer 1


Thank you for your help - I have found the offending function.

The plugin is meant to manage about 400,000 case files and provide a fast search. In order to manage the search on the front-end of the site, I need to manipulate the number of results found for any given search, so I added a filter at "found_posts" to do that, and that was breaking the pagination on the backend.

I added "if(is_admin()) return;" to that function and everything is hunky dory.

If you are interested in seeing a fast search in action, look for "dismissal" or something on http://dev.caselaw.co.za/search-page/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.