1

I am developing a wordpress plugin. I want the plugin to work on as many wordpress installations as possible.

In order to use various js and css scripts in the plugin. I want to make use of wp_register_script( $handle, $src, $deps, $ver, $in_footer );

My doubt is that, for eg. I have to use plupload functionality. On referring the documentation. http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Link_Scripts_Only_on_a_Plugin_Administration_Screen. I found that plupload script is included under default script.

How do I determine, that the wordpress installation has the script as default. This could be for any wordpress version. so that I do not have to manually add the scripts as a part of my plugin.

Thanks in Advance

1 Answer 1

0

Browsing WordPress versions, I see that /wp-includes/js/plupload/ was introduced on version 3.3. You can creat a check for versions lower than 3.3 in your register_activation_hook (and display an admin_notice or abort the installation). Or enqueue an alternative script if the version is lower.

From here, a function to check the current version

if ( ! function_exists( 'is_version' ) ) {
    function is_version( $version = '3.3' ) {
        global $wp_version;
        if ( version_compare( $wp_version, $version, '>=' ) ) {
            return false;
        }
        return true;
    }
}

And a relevant WPSE post: Code to determine WP version check

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.