Automattic\WooCommerce\EmailEditor\Engine
Email_Editor::get_current_post
Get the current post object
Метод класса: Email_Editor{}
Хуков нет.
Возвращает
array|mixed|WP_Post|null.
Использование
$Email_Editor = new Email_Editor(); $Email_Editor->get_current_post();
Код Email_Editor::get_current_post() Email Editor::get current post WC 11.3.0
public function get_current_post() {
if ( isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$post_id = 0;
if ( is_string( $_GET['post'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- data valid
$post_id = intval( $_GET['post'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- data valid
}
$current_post = get_post( $post_id );
} else {
$current_post = $GLOBALS['post'];
}
return $current_post;
}