wp_is_post_revision ALWAYS FALSE problem

Home Forums Calendar Products Events Calendar PRO wp_is_post_revision ALWAYS FALSE problem

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #132179
    Adrian Cumpanasu
    Participant

    In this plugin https://theeventscalendar.com/support/forums/topic/categorize-imported-events/ , the condition that checks if the event is a revision is always false, even when I am editing events in admin.

    I added this before and still doesn’t report otherwise:
    function tribe_revision_support() {
    add_post_type_support( ‘tribe_events’, ‘revisions’ );
    }
    add_action(‘init’, ‘tribe_revision_support’);

    #133110
    Barry
    Member

    OK – well the first thing I would try is increasing the priority of your callback – since our custom post types are registered during the same action it’s not impossible that you are trying to add post type support for revisions before they’ve actually been registered.

    I hope that helps 🙂

    #133731
    Adrian Cumpanasu
    Participant

    http://pastebin.com/yYYDiyes

    I set an echo and die that is now commented.
    I tried both 9999999 and 0 priority. Not working.

    #133911
    Barry
    Member

    If you’re not operating on a post revision though – and ordinarily you will not be, even if you are actively editing a post/event – we’d expect this to return false – so I’m not clear why that’s a problem here.

    if( $mrw_event_origin == 'facebook-importer' && !wp_is_post_revision( $post_id ) ) { /* ... */ }

    This is simply ensuring it doesn’t categorize post revisions. Does that clarify things at all? Unfortunately, though it’s awesome to see people sharing solutions on the forum, custom code like this isn’t something we can really support.

    #134602
    Adrian Cumpanasu
    Participant

    Maybe it is not the right condition. I want to test if it is a facebook event and is imported now, so it puts the events in a temporary public category “Latest”.
    From there an operator takes them and assigns the right categories.

    So the events will all be edited in the end. If i can’t find a way to use revision condition, maybe I can think of some other conditional.

    #135256
    Barry
    Member

    Sure – perhaps you could just test for the origin (as in the first half of that conditional statement) and additionally check if it is already assigned to a category or not?

    Really though this is one we’re going to have to leave to you – good luck!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘wp_is_post_revision ALWAYS FALSE problem’ is closed to new replies.