WC_Admin_Post_Types::hide_cpt_archive_templates
When editing the shop page, we should hide templates.
Method of the class: WC_Admin_Post_Types{}
No Hooks.
Returns
Array.
Usage
$WC_Admin_Post_Types = new WC_Admin_Post_Types(); $WC_Admin_Post_Types->hide_cpt_archive_templates( $page_templates, $theme, $post );
- $page_templates(array) (required)
- Templates array.
- $theme(string) (required)
- Classname.
- $post(WP_Post) (required)
- The current post object.
WC_Admin_Post_Types::hide_cpt_archive_templates() WC Admin Post Types::hide cpt archive templates code WC 10.5.0
public function hide_cpt_archive_templates( $page_templates, $theme, $post ) {
$shop_page_id = wc_get_page_id( 'shop' );
if ( $post && absint( $post->ID ) === $shop_page_id ) {
$page_templates = array();
}
return $page_templates;
}