WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] WP_VERSION constant introduced in 0.8.1beta (4 posts)

  1. Ov3rfly
    Member
    Posted 10 months ago #

    // Define current version constant
    define( 'CPT_VERSION', '0.8.1' );
    
    // Define current WordPress version constant
    define( 'WP_VERSION', get_bloginfo( 'version' ) );

    Please rename the WP_VERSION constant to something like CPT_WP_VERSION or similar to avoid possible name collisions, see also here:

    All the functions in your Plugin need to have unique names that are different from functions in the WordPress core, other Plugins, and themes. For that reason, it is a good idea to use a unique function name prefix on all of your Plugin's functions.

    https://codex.wordpress.org/Writing_a_Plugin

    http://wordpress.org/plugins/custom-post-type-ui/

  2. Michael Beckwith
    Member
    Plugin Author

    Posted 10 months ago #

    Will do, thanks for the feedback. Posted this to GitHub so that I can better keep track of it.

  3. Michael Beckwith
    Member
    Plugin Author

    Posted 10 months ago #

    Fixed

  4. Ov3rfly
    Member
    Posted 10 months ago #

    An additional note here, to compare versions, there is a PHP function version_compare().

    Current check, line 965 and 1606 in current 0.8.1beta:

    if ( CPTUI_WP_VERSION > '3.5' ) {

    Suggested check, something like this:

    if ( version_compare( CPTUI_WP_VERSION, '3.5', '>' ) ) {

    Thanks for the great plugin.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.