Hi,
Do you want to put together something that works with Events Manager locations, or something that replicates the locations feature but is separate?
Hi, I wanted to put locations in the database using the Events Manager functions, tables, etc, so it will work with the plugin.
I’ve been able to do so with EM_Location->save() and EM_Location->save_meta(), and adding the post metadata with add_post_meta().
What I need to do now is to use EM_Location->save and leave the post as pending, not as published. EM_Location->post_status = ‘pending’ does not work.
you can try to hook into em_location_set_status filter for this. for reference only, this is located under classes/em-location.php at around line 486 – 514
And is there any easy way to do this? I’m trying to do
$EM_Location->set_status(0);
$EM_Location->save();
$EM_Location->save_meta();
But this is not working, nor is $EM_Location->set_status(‘pending’);
Well, I found a patch solution, which is immediately after save_meta() downgrade the post to pending:
$EM_Location->save();
$EM_Location->save_meta();
wp_update_post( array( 'ID' => $EM_Location->post_id, 'post_status' => 'pending' ) );
I find this to be the most elegant solution besides making the save in pending status. Not ideal though, if you can point me to something better, I’d thank you.