Forums

[resolved] Keep my meta data when trashing (1 post)

  1. metamorpher
    Member
    Posted 1 year ago #

    Hi all... I'm new in the forums, but been using wordpress since last year, so my greetings to everyone who reads this post.

    Well, my question is about the following: I created a custom post to save data about used cars. To improve the "little fella" post I created a meta box, which saves some data about kilometers, color of the car, does it have airbags, stereo, abs, which engine, etc.

    The first issue I got was while the post were doing autosaving, it erased all the metadata inside the post. Well, I solved it by this portion of code inside my saving function

    if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
    			return $post_id;

    the issue comes when I was testing the Trashcan. I sent a post to the trashcan and was everything cool, no data lost. But when I restored it, the post was empty of data. I mean, it kept the title, the body, even the taxonomy. But ALL THE METADATA about the engine, color, kilometers, and so got lost.

    If you can help me, I would appreciate it.

    Thanks for being there people :D

Topic Closed

This topic has been closed to new replies.

About this Topic