0

I'm trying to make a shortcut in navigation that will take user to one certain post. So far I'm using

add_action('admin_menu', 'add_custom_menu_position');

function add_custom_menu_position() {
add_menu_page('FeaturedJobs', 'Featured Jobs', 'edit_posts', 'edit.php?post=706&action=edit',18); 
}

The item does show up in the admin menu, but every time I try to use it, it inserts admin? as a part of the link and I get You do not have sufficient permissions to access this page. error.

The final link looks like this: http://website_url/wp-admin/admin.php?page=post.php?post=706&action=edit

I know that I have enough capabilities to edit it, because I'm on an admin account and also once I use a regular edit link (http://website_url/wp-admin/post.php?post=706&action=edit), it works fine. I'm rather sure the problem is there because the link I'm trying to reach is wrong, but I can't find a way to link to it in any other way.

I'll be grateful for any hints, E.

0

When you are adding the menu slug as edit.php?post=706&action=edit, it is adding in the url after admin.php considering it as a new page in admin dashboard (general behaviour of add_menu_page())

So, you should give a fully qualified url instead. I think, admin_url() should help.

Try adding

admin_url('post.php?post=706&action=edit')

Or

admin_url('edit.php?post=706&action=edit')

instead of

edit.php?post=706&action=edit

as menu slug.

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.