dequeue motopress script and css

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #532088
    Hence Wijaya
    Participant

    We don’t use visual editor on every pages. Is it possible to dequeue motopress script and css when visual editor is not used?

    #532089
    [email protected]
    Participant

    +1. this is very important to improve page speed

    #534282
    J. Davis
    Keymaster

    Hi,

    Most elements enqueue styles and scripts when they are used only. You can also refer to thew following snippet

    add_action( 'wp_print_styles', 'my_theme_wp_print_styles' );
    function my_theme_wp_print_styles() {
    	if ( is_front_page() ) {
    		wp_dequeue_style('mpce-theme');
    		wp_dequeue_style('mpce-bootstrap-grid');
    		wp_dequeue_style('mpce-font-awesome');
    	}
    }

    Best regards,
    John

    #534465
    Hence Wijaya
    Participant

    Thanks John. Any reason why enqueue these styles when _mpce_enabled == false ?

    #538102
    J. Davis
    Keymaster

    Hi Hence,

    We can not be sure that user does not use buttons, tabs and other elements shortcodes out of the Visual Builder at his pages.

    Best regards,
    John

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.