WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Are you sure you want to do this? Please try again. (1 post)

  1. IM_natascha
    Member
    Posted 3 years ago #

    I was building a new post_type for my plugin and found this error on posting my first entry of this post_type.

    I found many entries in this forum, none answered satisfactingly, so I post my personal solution to my very own problem here to help those who encounter this problem in the future:

    You may find this description in GERMAN here: http://theverythought.wordpress.com/2011/01/09/der-beruhmte-are-you-sure-you-want-to-do-this-please-try-again-fehler/

    Setup: WP 3.0.4
    Plugins: only my own, all shipped plugins deleted
    Description of Error:
    Created new Posttype, wanted to fill an entry into Posttype, when "saving" the Posttype-Entry, I got to a nearly empty page with message: "Are you sure you want to do this? Please try again." and a link back to the add-new-{posttype}-page.

    My way to find the solution:
    activate WP-DEBUG (wp-config.php)
    find error-message

    "Notice: Trying to get property of non-object in….\wordpress\wp-admin\includes\meta-boxes.php on line 17"

    look into this file and see
    $can_publish = current_user_can($post_type_object->cap->publish_posts);
    at line 17.
    Add line: echo "<pre>".print_r($post,1)."</pre>"; in front of line 17. (You may also write echo "<pre>".print_r($post_type,1)."</pre>"; as this was the only information I finally needed.)

    Solution:
    I saw my posttype being cut to a total length. So instead of my probably 22 characters-long-posttype wordpress only handled 20 characters of it. When wordpress wanted to insert my 22characters-long-posttype, it compared the original posttype somewhere to an cut-down one and therefore got an internal error somewhere.
    As my posttype is put together from my Plugin-unique-string and one word to describe it, I shortened this posttype-string and it worked fine.

Topic Closed

This topic has been closed to new replies.

About this Topic