0

So I have a custom post type action and when I search in the admin panel I don't get any results. I think I figured out why, but not sure how to fix it. When I enter a search term and then click "Search actions" it takes me to this url:

http://localhost/wp-admin/edit.php?s=foobaz&post_status=all&post_type=action&action=-1&m=0&paged=1&mode=list&action2=-1

It shows no results, and I see why, but I don't understand where all those extra query vars are coming from? I disabled all plugins, emptied out my functions.php and still it takes me there, showing no results.

I can make it work if I manually change the url to:

http://localhost/wp-admin/edit.php?s=foobaz&post_status=all&post_type=action

The above will show any actions containing "foobaz".

Any ideas where do I begin to fix this?

  • 1
    I'll guess that you can't name your post type action, that's a query string var used by core in various contexts. Try renaming your post type slug to something else. – Milo Feb 8 '15 at 5:59
  • @Milo, I was trying that just now, but I would have to edit my database to get all actions transferred to the new pots type, will report back – elclanrs Feb 8 '15 at 6:00
  • @Milo, Yup, that was it! Feel free to post an answer. – elclanrs Feb 8 '15 at 6:09
1

The problem in this case is the name of the post type, action. WordPress core uses the query var action for its own purposes, so this has created a conflict somewhere within the code. The solution is to rename the post type to something unique to remove the conflict.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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