WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] Post not updated. Relationship data missing. (9 posts)

  1. Magenta Cuda
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/types/

  2. Srdjan
    Member
    Plugin Author

    Posted 1 year ago #

    We noticed that error and we're working on improving post relationship fields code.
    Will post here soon about fix.

  3. tanc
    Member
    Posted 1 year ago #

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

  4. tanc
    Member
    Posted 1 year ago #

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

  5. Magenta Cuda
    Member
    Posted 1 year ago #

    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.

  6. Magenta Cuda
    Member
    Posted 1 year ago #

    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;

  7. wmoll
    Member
    Posted 1 year ago #

    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) {

  8. brucepearson
    Member
    Plugin Author

    Posted 1 year ago #

    We've just uploaded a fix for this.

  9. AmirHelzer
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic