joedolson / my-calendar

My Calendar WordPress Plugin
https://www.joedolson.com/my-calendar/
GNU General Public License v3.0
20 stars 16 forks source link

Prevent My Calendar post types from showing in the WordPress exporter #542

Closed joedolson closed 7 months ago

joedolson commented 1 year ago

It won't work, so it would be better if they weren't available.

joedolson commented 1 year ago

There are no filters to remove the post types nor are there any class hooks I can use to hide them. Could do it with JS.

However, the array of event data is in a meta field in the post type. So I could take the export, then run a post-import action to set the event data for each imported post.

Could use the action import_post_meta to do this.

do_action( 'import_post_meta', $post_id, $key, $value );

Also to do: when importing terms, create categories if don't exist. wp_import_insert_term (runs only after a term is inserted, so will only apply for terms that don't already exist.

do_action( 'wp_import_insert_term', $t, $term, $post_id, $post );

joedolson commented 1 year ago

Note: confirmed that yes, the meta data is being updated when the event is updated.

carstingaxion commented 9 months ago

Hello. Excuse me, when I ask but, isn't that the purpose of the can_export attribute? Couldn't you use that?

joedolson commented 9 months ago

@carstingaxion Yep, indeed it is. I should use that - at least until I've done the necessary work to make it a viable import/export methodology. Thanks! I hadn't thought about the post type registration options.