Easy Custom Fields
[resolved] Field content disappears when saving (3 posts)

  1. theoldswitcheroo
    Posted 5 years ago #

    I tried using the 'Simple Usage' code in my functions.php file. I got it to come up like I needed at the bottom of my posts and then I entered the information.

    Once I click update/publish on the post the screen refreshes and says published. Then I scroll down and realize that the content I just entered in the fields has disappeared.

    Can someone please help me figure out why this is?

    Thanks in advance!


  2. sjwilliams
    Posted 5 years ago #

    I also noticed this. I'm running WP 3.2.1 and ECF 0.1.

    I've poked around a bit and it looks like the plugin is failing on this line:

    if ( !current_user_can( $post_type_object->edit_cap ) )

    From what I can tell, the $post_type_object, which is from get_post_type_object(), doesn't actually contain edit_cap. The object does contain $post_type_object->capability_type, but as admin returns 'post,' which isn't on this list for current_user_can() (http://codex.wordpress.org/Roles_and_Capabilities).

    In the end, I changed the line to:
    if ( !current_user_can( $post_type_object->cap->edit_post ) )

    There are several user roles under $post_type_object->cap. I figured if the user is allowed to edit the post, the should be allowed to add custom field data.

    Everything *seems* to be working now. YMMV.

  3. Thorsten Ott
    Plugin Author

    Posted 4 years ago #

    Thanks for pointing this out. I updated the plugin accordingly.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Easy Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic