'acf_post_type', 'name' => 'Post Type', ); $ct->add( $args ); } public function addRegisteredPostTypes() { $cts = $this->getPostTypes(); foreach( $cts as $ctPost ) { $this->registerPostType( $ctPost ); } } public function registerPostType( $ctPost ) { $ct = new ACFPT_PostType; $fields = get_fields( $ctPost->ID ); $args = array( 'key' => $fields['key'], 'name' => $ctPost->post_title, 'settings' => $fields, ); $ct->add( $args ); } public function getPostTypes() { return get_posts( array( 'post_type' => 'acf_post_type', 'posts_per_page' => 250 )); } public function unregisterPostType( $post_type ) { global $wp_post_types; if ( isset( $wp_post_types[ $post_type ] ) ) { unset( $wp_post_types[ $post_type ] ); return true; } return false; } }