Home › Forums › Calendar Products › Events Calendar PRO › wp_is_post_revision ALWAYS FALSE problem
- This topic has 5 replies, 2 voices, and was last updated 10 years ago by Barry.
-
AuthorPosts
-
April 14, 2014 at 2:43 am #132179Adrian CumpanasuParticipant
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’);April 15, 2014 at 7:37 am #133110BarryMemberOK – 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 🙂
April 16, 2014 at 1:17 am #133731Adrian CumpanasuParticipantI set an echo and die that is now commented.
I tried both 9999999 and 0 priority. Not working.April 16, 2014 at 7:44 am #133911BarryMemberIf 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.
April 17, 2014 at 2:00 am #134602Adrian CumpanasuParticipantMaybe 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.
April 17, 2014 at 8:29 am #135256BarryMemberSure – 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!
-
AuthorPosts
- The topic ‘wp_is_post_revision ALWAYS FALSE problem’ is closed to new replies.