0

I have created a page in my admin with this custom query:

$rows = $wpdb->get_results("SELECT * FROM ej_feedback ORDER BY createdtime ASC");

I have made it successfully paginate as required in that the right amount of posts show on first page and the right amount of pagination links show up. Awesome!

However when I click on one of the pagination links to go onto page 2, I get an admin error:

You do not have sufficient permissions to access this page

The url looks like this:

/wp-admin/admin.php?page=user-feedback/user-feedback.php/page/2/

I really don't know why I'm getting this error in the admin. Is it a more general issue with the admin or is it related to using pagination in the admin area? Any help would be much appreciated.

The script works perfectly on the frontend - I just think Wordpress has a problem with the URL generated.

1 Answer 1

2

The last part of the URL is being treated as part of the page value..

/wp-admin/admin.php?page=user-feedback/user-feedback.php/page/2/

The bold part is your plugin page, so when you go adding parts onto that URL it's considered to be part of that URL.

If you use this instead it should work no problem.

/wp-admin/admin.php?page=user-feedback/user-feedback.php&paged=2

Note: You can actually reproduce the problem quite easily adding anything else on in the same manner, eg.

/wp-admin/admin.php?page=user-feedback/user-feedback.php/foobar/

If you want pretty paged URLs for your plugin page you'll have to look into creating additional rewrites for those pages yourself, but that's perhaps for another question...(and not one i have time to answer - this particular issue was pretty easy to spot)

0

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.