• Resolved Magenta Cuda

    (@magenta-cuda)


    When adding a child in the “Edit <Parent>” page the error “Post not updated. Relationship data missing.” is returned. It seems that when get_post_type($post) is called by function wpcf_admin_post_get_post_groups_fields() in “fields-post.php” the object $post is modified as a side effect. In particular, $post->ID is set to 0. Very unkind for WP 3.5 to do this. As a workaround changing the call to get_post_type($post->ID) seems to work. I am using Types 1.1.3.3.

    https://www.ads-software.com/extend/plugins/types/

Viewing 8 replies - 1 through 8 (of 8 total)
  • We noticed that error and we’re working on improving post relationship fields code.
    Will post here soon about fix.

    yep – same issue. Plugin seems broken under 3.5. Unable to create child posts – which is kind of crucial!

    Additionally, the workaround provided above didn’t seem to work for me.

    Thread Starter Magenta Cuda

    (@magenta-cuda)

    Hi tanc,

    I just re-verified the work around again on my system so there must be some crucial difference in our two systems.

    First let us make sure we changed the same things:
    In file “… \wp-content\plugins\types\embedded\includes\fields-post.php” line 905 was changed from:
    $post_type = get_post_type($post);
    to:
    $post_type = get_post_type($post->ID);

    After this change are you getting exactly the same error “Post not updated. Relationship data missing.” or a new one.

    My WordPress version is 3.5 and Types version is 1.1.3.3.
    Are you running any other plugins? I run only one other plugin BackWPup. (I don’t actually use Types for real work but I have it around for evaluation purposes only – hence the stripped environment.)

    This error is very strange. The developers states 1.1.3.3 is verified on WP 3.5.0 so this must be working on the developers’ system. But it is just completely broken on my system. The above two calls to get_post_type() should be equivalent but on my system at least they are not.

    Anyway I find this problem interesting and would greatly appreciate getting more info from you.

    Thread Starter Magenta Cuda

    (@magenta-cuda)

    I have done more investigating of this problem.

    In the call in file
    “… \wp-content\plugins\types\embedded\includes\fields-post.php”
    on line 905

    $post_type = get_post_type($post);

    $post is not a real post object but a dummy created in

    “… \wp-content\plugins\types\embedded\includes\post-relationship.php”
    on lines 284-288 as follows:
    $item->ID = ‘new_’ . wpcf_unique_id(serialize($post));
    $item->post_title = ”;
    $item->post_content = ”;
    $item->post_type = $post_type;

    I am not sure what get_post_type($post) should do when it is called on a non-existent dummy post object but it seems like a bad idea and anyway in this case the call is unnecessary since post_type is a field in the dummy object.

    So I think line 905 of file
    “… \wp-content\plugins\types\embedded\includes\fields-post.php”
    should be changed from
    $post_type = get_post_type($post);
    to:
    $post_type = $post->post_type;

    for resolve this problem need to replace in
    \wp-content\plugins\types\embedded\includes\post-relationship.php
    line 806
    from
    if (strpos($post_id, ‘new_’) !== false) {
    to
    if (strpos($post_id, ‘new_’) !== false or $post_id==0) {

    Plugin Contributor brucepearson

    (@brucepearson)

    We’ve just uploaded a fix for this.

    Plugin Author Amir Helzer

    (@amirhelzer)

    I hope that the temporary fix is working for everyone here. The problem has been fixed in the code and updated in the current version.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Post not updated. Relationship data missing.’ is closed to new replies.