remove the ASP button in the editor

Home Forums Product Support Forums Ajax Search Pro for WordPress Support remove the ASP button in the editor

This topic contains 11 replies, has 2 voices, and was last updated by mistermixmania mistermixmania 3 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #47463
    mistermixmania
    mistermixmania
    Participant

    Hello 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östa

    #47470
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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');
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47478
    mistermixmania
    mistermixmania
    Participant

    Hello,
    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östa

    #47480
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    The 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' );
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47482
    mistermixmania
    mistermixmania
    Participant

    Hello,
    unfortunately still there. See Appendix.

    Best regards,
    Gösta

    Attachments:
    You must be logged in to view attached files.
    #47484
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Where do you add the suggested custom code?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47487
    mistermixmania
    mistermixmania
    Participant

    In functions.php

    Best regards,
    Gösta

    #47490
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    That 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' );
    });
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47496
    mistermixmania
    mistermixmania
    Participant

    Hello,
    unfortunately still there. 🙁

    Best regards,
    Gösta

    #47505
    mistermixmania
    mistermixmania
    Participant

    Hello,

    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östa

    #47507
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    That’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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47509
    mistermixmania
    mistermixmania
    Participant

    Thank you very much,
    Gösta

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.