• Resolved dancingpony

    (@dancingpony)


    We have our options set to use a very basic captcha, so the styles dictated in the included stylesheet aren’t even being used.

    Is there a way to remove the stylesheet from the page so it doesn’t add an unnecessary call to another asset?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    Thank you for contacting us!

    Unfortunately, there is no chance to detect if the Captcha would be present on the page in advance, so we have to add captcha CSS styles anyway.

    However, there is a way to remove it where it’s unnecessary.
    Please go to the plugin settings page, open “Custom code” tab, mark the “Activate” option in the “Editing bws-custom-code.css” section, and add the following code:

    
    function remove_captcha_styles() {
        $post_id = get_the_ID();
    
        /* your condition, describing where captcha styles shouldn't be added, for example if the post ID is not 1, 5 or 121: */
        if ( ! ( ! empty( $post_id ) && in_array( $post_id, array( 1, 5, 121 ) ) ) ) {
            remove_action( 'wp_enqueue_scripts', 'cptch_front_end_styles' );
        }
    }
    add_action( 'wp_enqueue_scripts', 'remove_captcha_styles', 1 );

    Please let us know if everything is okay now.

    Sincerely,
    BestWebSoft Support Team

    Hi,

    Since there is no reply from you, we consider this topic as resolved. We hope you’ve found the solution. If you have any questions, please feel free to contact us via our Help Center – https://support.bestwebsoft.com/.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove Plugins Default CSS Call’ is closed to new replies.