• Resolved pavelthq

    (@pavelthq)


    Hello, I am from Visual Composer development team. We have investigated that diff wp-admin/edit-form-advanced.php
    in current develop is added:

    global $post_type, $post_type_object, $post;

    line #13. but in master there is no such line added.

    Problem is that we are including edit-form-advanced.php and these lines was “resetting” values to “null”.

    Once we delete this line no problem happens ($post_type is “page”, without remove => “null”).

    Hope you will remove this, or give some workaround for this.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Pavel, which plugin is yours? Can you link to it?

    No offense, but there are 40k plugins when you count the closed ones, and since you already know which one is yours, it makes it patently clear to us which it is if you just link ??

    Looks like this was added here: https://core.trac.www.ads-software.com/changeset/31121

    Those lines are calling the global and should be resetting to null. Can you link to the line in your code that does this? Maybe you’re not calling the post ID right?

    Thread Starter pavelthq

    (@pavelthq)

    I understand you, our plugin is commercial and available in https://codecanyon.net/item/visual-composer-page-builder-for-wordpress/242431

    As for code, we have local $post, $post_type when rendering editor
    and we including edit-form-advanced.php to make available #content usage and other meta-form attributes.

    But in current development wp version we found global $post_type, $post..
    line added this is not defined as global when we are rendering editor.
    So in master this also used as local.

    Thread Starter pavelthq

    (@pavelthq)

    Hello, I understand you. Our plugin is commercial and available in https://codecanyon.net/item/visual-composer-page-builder-for-wordpress/242431

    As for code.
    When we rendering frontend editor we using edit-form-advanced.php
    But unfortunately variables $post_type and $post is defined as local (not in $GLOBALS) so when we are including edit-form-advanced.php – they found nothing and set variables to “null”. But in 4.1.1 they use our local variables.

    It is possible to fix from your side?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I’d really want to SEE your code before I said “This is a bug in WordPress” vs your code doing something in a weird way.

    But unfortunately variables $post_type and $post is defined as local

    Are you saying in YOUR code you define them locally? And it’s just a variable conflict?

    Thread Starter pavelthq

    (@pavelthq)

    Hello, we solved issue itself, by defining these variables as global too.

    I’m just write here to make you know that this line of code was made some issue. So others plugins can have same issue with this reason.

    I will also check changelog (to see why this line is added).

    Thanks you.

    Thread Starter pavelthq

    (@pavelthq)

    File: A.php

    $post = the_post();
    $post_type = $post->post_type;
    
    var_dump($post); // object
    var_dump($post_type); // "page"
    include wp-admin/edit-form-advanced;

    File edit-form-advanced.php

    before "global $post_type, $post..."
    var_dump($post); // object
    var_dump($post_type); // "page"
    
    after "global $post_type, $post"
    var_dump($post); // null
    var_dump($post_type); // null

    But it 4.1.1 var_dump($post); = object var_dump($post_type) = “page” in edit-form-advanced.

    Moderator Marius L. J.

    (@clorith)

    I’d just like to shoot in, that it’s generally not advised to use variable names that are used by core ($post being a pretty prominent one).

    One should always prefix things in plugins and themes when possible as it avoids collisions down the line ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Edit-Form-Advanced compatibility change’ is closed to new replies.