1 ) ); $ee_post_types = array_keys( $ee_post_types ); $post_types = array_merge( $post_types, $ee_post_types ); $post_types = array_unique( $post_types ); } return $post_types; } /** * This function removes ACF post types from the tabify edit screen (post type selection sidebar) * * @since 3.5.1 * * @param array $posttypes An array of post types supported by tabify. * @return array */ public function tabify_posttypes( $posttypes ) { // unset ACF post types unset( $posttypes['acf-field-group'] ); unset( $posttypes['acf-field'] ); return $posttypes; } /** * This function creates dummy metaboxes on the tabify edit screen page * * @since 3.5.1 * * @param string $post_type The name of the displayed post type. */ public function tabify_add_meta_boxes( $post_type ) { // get field groups $field_groups = acf_get_field_groups(); if ( ! empty( $field_groups ) ) { foreach ( $field_groups as $field_group ) { // vars $id = "acf-{$field_group['key']}"; $title = 'ACF: ' . $field_group['title']; // add meta box add_meta_box( $id, acf_esc_html( $title ), '__return_true', $post_type ); } } } /** * This filter will prevent PTS from running on the field group page * * @since 5.0.0 * * @param array $pages An array of pages PTS should run on. * @return array */ public function pts_allowed_pages( $pages ) { // vars $post_type = ''; // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Verified elsewhere. // check $_GET because it is too early to use functions / global vars. if ( ! empty( $_GET['post_type'] ) ) { $post_type = sanitize_text_field( $_GET['post_type'] ); } elseif ( ! empty( $_GET['post'] ) ) { $post_type = get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized when get_post_type() calls get_post(). } // phpcs:enable WordPress.Security.NonceVerification.Recommended // check post type if ( $post_type == 'acf-field-group' ) { $pages = array(); } // return return $pages; } /** * Runs during 'admin_enqueue_scripts' if dark mode is enabled * * @since 5.7.3 */ public function doing_dark_mode() { wp_enqueue_style( 'acf-dark', acf_get_url( 'assets/css/acf-dark.css' ), array(), ACF_VERSION ); } } new acf_third_party(); endif;