Changeset 7621
- Timestamp:
- 08/17/2018 05:48:26 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/o2-private-posts/o2-private-posts.php
r7618 r7621 28 28 add_filter( 'o2_create_post', __NAMESPACE__ . '\set_post_status', 10, 2 ); 29 29 add_action( 'o2_writeapi_post_created', __NAMESPACE__ . '\handle_meta_data', 10, 2 ); 30 add_action( 'transition_post_status', __NAMESPACE__ . '\handle_admin_meta_data', 12, 3 ); 30 31 } 31 32 add_filter( 'init', __NAMESPACE__ . '\init' ); … … 100 101 101 102 if ( class_exists( 'o2_Tags' ) ) { 102 $post = get_post( $post_id ); 103 $post_tags = o2_Tags::find_tags( $post->post_content, true ); 104 $post_tags = array_unique( $post_tags ); 103 $post = get_post( $post_id ); 104 105 if ( ! empty( $GLOBALS['o2'] ) ) { 106 $post_tags = $GLOBALS['o2']->tags->gather_all_tags( $post ); 107 } else { 108 $post_tags = o2_Tags::find_tags( $post->post_content, true ); 109 $post_tags = array_unique( $post_tags ); 110 } 105 111 106 112 if ( ! empty( $post_tags ) ) { … … 109 115 } 110 116 } 117 118 /** 119 * Sets O2_ToDo state and post tags when a private post is published from wp-admin. 120 * 121 * @param string $new Status being switched to. 122 * @param string $old Status being switched from. 123 * @param \WP_Post $post The full Post object. 124 */ 125 function handle_admin_meta_data( $new, $old, $post ) { 126 if ( 'private' === $new ) { 127 handle_meta_data( $post->ID, (object) [ '_post_privately' => true ] ); 128 } 129 }
Note: See TracChangeset
for help on using the changeset viewer.