[Plugin: CPT-onomies: Using Custom Post Types as Taxonomies] CPT with publish_post action
-
First, thanks for your great plugin.
I’m trying to get CPT-onomies terms of a post with “publish_post” action. But $terms varialble is always empty.
What’s wrong?add_action( 'publish_custom_post', 'custom_function' ); function custom_function ($post_id) { $post = get_post($post_id); $value = $post->post_modified; $terms = wp_get_object_terms($post->ID, 'cpt_taxonomy'); foreach ($terms as $term) { add_post_meta($term, 'custom_meta_field', $value, false); } }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘[Plugin: CPT-onomies: Using Custom Post Types as Taxonomies] CPT with publish_post action’ is closed to new replies.