Skip Navigation

[Résolu] Hide "Edit this View" and "Edit this Content Template" mentions

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.

Marqué : 

This topic contains 7 réponses, has 3 voix.

Last updated by Peter Il y a 8 années et 5 mois.

Assigned support staff: Caridad.

Auteur
Publications
#33488

Hello and Happy New Year for you all,
Is there a way I can hide the "Edit this View" and "Edit this Content Template" mentions for Editors and Administrators alike in Views ?

Thank you,
Best,
Stephen

#33544

Dear Stephen,

This link is displayed to users that can 'Manage Options', like administrators. Editors should not be seeing this link at all. However, try adding these lines to functions.php to remove them:

add_filter('init', 'remove_edit_links', 100);
function remove_edit_links() {
remove_all_filters('edit_post_link');
}

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#33547

Thanks Caridad,

The link is hidden on Posts.
But the link still appears on the Pages.

Thanks,
S.

#33564

Dear Stephen,

Can you find out how the theme is displaying this link?

Regards,
Caridad

#33596

Caridad,
I will send the link to the website to your private email address. Do not disclose please.

Best,
Stephen

#33877

Dear Stephen,

As far as I can see, the links that we still need to remove are the widget links, but there is not filter to remove them like with the others. A workaround is to detect the text when its being translated and removing it there. I added these lines to the ones above and its working:

add_filter('gettext', 'remove_widget_links', 100, 3);
function remove_widget_links($translated, $text, $domain) {
if ($text == 'Edit view') return '';
return $translated;
}

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#36258

Thanks Caridad,
It works fine and I will definitely add this code snippet to my standard library!
Best,
Stephen

#86996

Caridad wrote:

"This link is displayed to users that can 'Manage Options', like administrators. Editors should not be seeing this link at all."

This link is being displayed to Editors in Views 1.2.1, when a View is embedded on a Page. Is this a bug?