Export custom types/tax/fields as PHP file?

Be warned: this is a crazy idea/question:

Now, I’m sure that ultimately the function of CustomPress is to output a sheet of PHP code into WordPress that defines all the custom post/tax/field types. This probably resembles a plugin’s php file or theme’s functions.php file.

Let’s say I wanted to freeze my settings and export them as a plugin. That is, let’s say I wanted to capture that outputted PHP all by itself and paste it into my own plugin. Let’s say, for example, a project management plugin. Or a Yelp-like plugin.

How would I do it?


  • Patrick
    • Support Monkey

    Hi @dschulzjackson

    Sorry to disappoint, but I think you’re going about this the wrong way. CustomPress simply registers the post type by creating new entries in the post_type column of the existing wp_posts table. All data associated with the post type is sent and stored there.

    It does not output any php code. Your code would need to be written in order to call the data associated with your post type.

    For help on creating your plugin, see the codex here: http://codex.wordpress.org/Writing_a_Plugin

    If someone more knowledgeable would like to jump in here to give more tips, I think they’d be welcome. :slight_smile:

  • dschulzjackson
    • Design Lord, Child of Thor

    Sure. Makes sense. It registers the post types 1 by 1 as it runs through its script, instead of writing them all out 1 by 1 on a php sheet somewhere and registering them all at once.

    How realistic would it be to request a feature that outputs the content as a php sheet full of register_taxonomy() and register_post_type()? The data’s all there in the database entries; the whole plugin is pretty much just holding our hand through the process of setting the parameters for register_taxonomy(). So it’s reasonable that it could “export as php” all those types and parameters we’ve created.

    And let’s be real; that would be AWESOME.

  • dschulzjackson
    • Design Lord, Child of Thor

    Thanks, I appreciate this and will try it out.

    Moving between installs is definitely nifty and it’s totally great that you’re enabling it.

    But ultimately my goal is to create and package a single plugin, which is why I was wondering about getting the custom type/tax/field configs exported as php.

    But for now, exporting settings to go between installs (and to back them up) is good enough for me. Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.