Support » Plugin: Custom Post Type UI » CPTUI post types `can_export` is always set to false.

  • Resolved davsev

    (@davsev)


    Hi, I am building a plugin and I want to be able to show the CPTUI custom post types I created with CPTUI.
    I execute the get_post_types function, it returns all the plugins except the ones I created with CPTUI.
    This is the code I used:

    		$post_types = get_post_types( [
    			'public' => true,
    			'can_export' => true,
    		] );

    After some investigation, I found out that the CPT can export value is always set to FALSE, though I have set it to TRUE in the UI.

    What can I do about that?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Biggest thing is to make sure you’ve upgraded to 1.11.2 as we fixed an unintended bug around can_export settings during registration.

    Next part is that you shouldn’t be needing can_export with get_post_types() to fetch ones registered by CPTUI.

    For example, I was able to get all the expected post types with just this:

    get_post_types( [ '_builtin' => false ] );
    

    I believe the “can_export” is meant more for /wp-admin/export.php under the WP Admin Tools menu.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    This got resolved in 1.11.2.

    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CPTUI post types `can_export` is always set to false.’ is closed to new replies.