• Resolved HB

    (@hbazan85)


    Hello

    I see that the following is always loading in the backend:

    wp-content/plugins/wp-user-avatar/assets/select2/select2.min.css

    regardless of the screen I’m on (i.e., editing a post, a page, or anything else), when plugin scripts or styles like the one mentioned should only load on the plugin’s specific screens (I’m referring to these: https://prnt.sc/MX43UoW2eufy).

    Can you fix this or send a code to temporary fix?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Collins Agbonghama

    (@collizo4sky)

    We use the library in non-profilepress admin pages such as WordPress user profile page that is why we load it globally.

    You can use the code snippet below to help restrict loading it only to ProfilePress admin pages.

    add_action('wp_print_scripts', function () {
        if ( ! ppress_is_admin_page()) {
            wp_deregister_script('ppress-select2');
        }
    }, 99);
    
    add_action('wp_print_styles', function () {
        if ( ! ppress_is_admin_page()) {
            wp_deregister_style('ppress-select2');
        }
    }, 99);
    Thread Starter HB

    (@hbazan85)

    thanks

    and to check if plugin is activated, the code to open is this?

    if ( class_exists(‘ppress’) ) {
    // code here
    }

    or another?

    Plugin Author Collins Agbonghama

    (@collizo4sky)

    You can do

    if ( class_exists('\ProfilePress\Core\Base') ) {
    // code here
    }
Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.