Automattic\WooCommerce\Internal\Admin\ProductReviews
Reviews::edit_review_parent_file
Highlights Product -> Reviews admin menu item when editing a review or a reply to a review.
Метод класса: Reviews{}
Хуков нет.
Возвращает
Строку.
Использование
$Reviews = new Reviews(); $Reviews->edit_review_parent_file( $parent_file );
- $parent_file(строка|разное) (обязательный)
- Parent menu item.
Заметки
- Global. Строка.
$submenu_file
Код Reviews::edit_review_parent_file() Reviews::edit review parent file WC 10.7.0
public function edit_review_parent_file( $parent_file ) {
global $submenu_file, $current_screen;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( isset( $current_screen->id, $_GET['c'] ) && 'comment' === $current_screen->id ) {
$comment_id = absint( $_GET['c'] );
$comment = get_comment( $comment_id );
if ( isset( $comment->comment_parent ) && $comment->comment_parent > 0 ) {
$comment = get_comment( $comment->comment_parent );
}
if ( isset( $comment->comment_post_ID ) && get_post_type( $comment->comment_post_ID ) === 'product' ) {
$parent_file = 'edit.php?post_type=product';
$submenu_file = 'product-reviews'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
}
}
return $parent_file;
}