Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › remove the ASP button in the editor
- This topic has 11 replies, 2 voices, and was last updated 2 years, 2 months ago by
mistermixmania.
-
AuthorPosts
-
March 20, 2024 at 11:56 am #47463
mistermixmania
ParticipantHello dear team,
I would like to remove the ASP button in the editor. Unfortunately I can’t find anything in the settings. I found a way to deactivate the metabox, but unfortunately no way to remove the ASP button.
How can I achieve this? I don’t want my subscribers to see the button.Best regards,
GöstaMarch 20, 2024 at 1:27 pm #47470Ernest Marcinko
KeymasterHi Gösta,
I guess you are referring to the Classic editor (tinymce)?
There is no option, but I think it might be possible via some custom code. Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
remove_action('admin_head', 'wpdreams_asp_add_mce_button'); remove_action('admin_head', 'wpdreams_asp_mce_generate_variable');March 20, 2024 at 2:52 pm #47478mistermixmania
ParticipantHello,
unfortunately still there. If I remove the following in the… it works. But I need a solution without interfering with the script.wp-content/plugins/ajax-search-pro/includes/classes/Core/ Manager.php
// Special case
if ( wpdreams_on_backend_post_editor() ) {
require_once(ASP_PATH . “/backend/tinymce/buttons.php”);
require_once(ASP_PATH . “/backend/metaboxes/default.php”);
}Best regards,
GöstaMarch 20, 2024 at 2:56 pm #47480Ernest Marcinko
KeymasterThe code above is the only way without changing the files. Hooks can be tricky, the order of execution is important.
Maybe using the hooks to the mce as well could work:
remove_action('admin_head', 'wpdreams_asp_add_mce_button'); remove_action('admin_head', 'wpdreams_asp_mce_generate_variable'); remove_filter( 'mce_external_plugins', 'wpdreams_asp_add_tinymce_plugin' ); remove_filter( 'mce_buttons', 'wpdreams_asp_register_mce_button' );March 20, 2024 at 3:01 pm #47482mistermixmania
ParticipantHello,
unfortunately still there. See Appendix.Best regards,
GöstaMarch 20, 2024 at 3:04 pm #47484Ernest Marcinko
KeymasterWhere do you add the suggested custom code?
March 20, 2024 at 3:29 pm #47487mistermixmania
ParticipantIn functions.php
Best regards,
GöstaMarch 20, 2024 at 3:38 pm #47490Ernest Marcinko
KeymasterThat should work though, maybe putting it to the actual hook for a delay:
add_filter('admin_head', function(){ remove_action('admin_head', 'wpdreams_asp_add_mce_button'); remove_action('admin_head', 'wpdreams_asp_mce_generate_variable'); remove_filter( 'mce_external_plugins', 'wpdreams_asp_add_tinymce_plugin' ); remove_filter( 'mce_buttons', 'wpdreams_asp_register_mce_button' ); });March 20, 2024 at 5:47 pm #47496mistermixmania
ParticipantHello,
unfortunately still there. 🙁Best regards,
GöstaMarch 21, 2024 at 9:48 am #47505mistermixmania
ParticipantHello,
since it doesn’t work with the removes… is it possible to program an option in the settings where the admin only wants to have a file placed above the button in the editor or not?
This could then be queried in the following query.
wp-content/plugins/ajax-search-pro/includes/classes/Core/ Manager.php
// Special case
if ( wpdreams_on_backend_post_editor() ) {
require_once(ASP_PATH . “/backend/tinymce/buttons.php”);
require_once(ASP_PATH . “/backend/metaboxes/default.php”);
}Thanks
GöstaMarch 21, 2024 at 10:05 am #47507Ernest Marcinko
KeymasterThat’s unfortunate.
Well, the problem with that solution is that the options may not be accessible at that point of execution yet, I will have to check.
Either way I have made a feature request on this, and I will make sure to deal with it before the upcoming release.March 21, 2024 at 12:02 pm #47509mistermixmania
ParticipantThank you very much,
Gösta -
AuthorPosts
- You must be logged in to reply to this topic.