• Resolved theoldswitcheroo

    (@theoldswitcheroo)


    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!

    https://www.ads-software.com/extend/plugins/easy-custom-fields/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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() (https://codex.www.ads-software.com/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.

    Plugin Author Thorsten Ott

    (@tott)

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Easy Custom Fields] Field content disappears when saving’ is closed to new replies.