Skip Navigation

[Resolved] Add edit post link in menu

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by hernanL 7 months ago.

Author
Posts
#2699325

Hello, I am working on an editing form in a project and I would really like each user to be able to edit their own post from the menu. I am trying to insert it as a sub-menu

I understand that there are several ways to achieve this, my first attempt was with shortcode, the advantage would be that I could easily place it inside the submenu

Since WordPress does not allow shortcode in the menu, I enabled it with this filter:

add_filter('wp_nav_menu_items', 'do_shortcode');

Then in the wordpress menu I inserted the shortcode in the desired submenu format

Url: #
Label: [toolset-edit-post-link content_template_slug='12904' target='self']Edit[/toolset-edit-post-link]

The link is only visible when viewing the post. I'm close but it wouldn't work, I need the link to work whenever the user is logged in, regardless of the page they are visiting at the moment

Is my approach correct or would you recommend another approach?

I think this might be interesting for everyone, maybe in the future you could consider integrating this natively

In my particular case I am without a child theme but I am with GeneratePress

Thank you very much, regards

#2699332

The more I analyze the situation I find it more difficult. I think the Toolset shortcode can never work (since it is designed and intended for loops)

I think the only way would be to "build" a custom field with the prepared link and move that information to each user's database, only there one could insert a shortcode in menu

Putting it in perspective it sounds quite complex and difficult. I think I shouldn't be the first to try this, it would be very nice to be able to allow the user to edit their own ad or post from the menu

Will there be a successful record of someone who tried to place an edit post link in the menu?

#2699496

I found the way, I'm a little complicated but I think I can figure it out by myself