WordPress.org

Ready to get started?Download WordPress

Forums

Lose the data in Custom Fields (5 posts)

  1. nicojaure
    Member
    Posted 3 years ago #

    Hi

    I'm having some problems with the custom fields.
    I have made a custom post type and modified the admin to make the custom fields more friendly.
    I'm using:

    add_action("admin_init", "add_muro");
    add_action('save_post', 'update_muro');
    add_action('edit_post', 'update_muro');

    Everything seems great but after some time the flieds appear empty.

    Can you helpme with some tip?
    Tell me if you need to know anything else...

    Thanks

  2. extatix
    Member
    Posted 3 years ago #

    It's autosave that messes it up. Did you include

    if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE )
    		return $post_id;
    
    		if ('page' == $_POST['post_type']) {
            if (!current_user_can('edit_page', $post_id)) {
                return $post_id;
            }
        } elseif (!current_user_can('edit_post', $post_id)) {
            return $post_id;
        }

    in your functions?

  3. nicojaure
    Member
    Posted 3 years ago #

    thanks extatix!
    I thought it was the autosave but I was not sure.

    I'm not using it
    where it should be?
    I'm puting it before "funtion xx (yy) {" and after the rest of the code.

    thanks again.

  4. extatix
    Member
    Posted 3 years ago #

    I've put it in my save function.

  5. nicojaure
    Member
    Posted 3 years ago #

    I did it but the problem is still there.
    Did it solve it in your case?
    Are there any way to turn off autosave?

Topic Closed

This topic has been closed to new replies.

About this Topic