Home Forums General Issues Migraging from CPTUI


Migraging from CPTUI

  • I’ve previously used CPTUI, and recently migrated my CPTs and Taxonomies to ACF.

    In order to get CPTs to show up in my archives, I used to make a call to cptui_get_post_type_slugs(), which no longer works since I’ve disabled CPTUI.

    What’s the right way to get the CPT slugs from ACF?

    Here’s the full source I was using to merge my CPTs with the “normal” archive post types:

    function my_cptui_add_post_types_to_archives( $query ) {
      // We do not want unintended consequences.
      if ( is_admin() || ! $query->is_main_query() ) {
      if ( (is_category() || is_tag() ) && empty( $query->query_vars['suppress_filters'] ) ) {
        $cptui_post_types = cptui_get_post_type_slugs();
        $all_post_types = array_filter(array_merge( (array)get_query_var('post_type'), (array)$cptui_post_types ));
        $post_type_filter = $_GET["post_type"];
        if (!empty($post_type_filter) && in_array($post_type_filter, $all_post_types)) {	
                      array ( $post_type_filter )
    add_filter( 'pre_get_posts', 'my_cptui_add_post_types_to_archives' );
  • ACF goes not appear to have a similar function or at least I cannot find one. It appears that the the function in cpt-ui only gets post types registered by the plugin.

    You’re best bet to get an answer here would be to contact the devs or submit a ticket.

  • Thanks John.

    Turns out I opened a ticket at the same time I started this thread, not knowing which was the best path to take. So far, I’ve only gotten a “have you watched the YouTube video on importing CPTUI schema via the ACF plugin UI,” but hopefully they’ll get me to a dev or someone who is more familiar with the code side of things reasonably quickly.


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.