All Collections
Personal websites
Publishing to multiple WordPress post types
Publishing to multiple WordPress post types

Learn how to setup your StoryChief setup to publish to multiple content types.

Gregory Claeyssens avatar
Written by Gregory Claeyssens
Updated over a week ago

Sometimes you want to manage multiple post types with StoryChief. Say a news section and a blog section. This setup can be created with StoryChief with a little customization. The following section is mildly technical and assumes basic PHP skills.

Start publishing to multiple post types

Step 1. Create a custom field on StoryChief to switch between the post types. Typically you would want to use single select field. Enter the machine name of your post type as value.

πŸ”” Note: Find more information about custom fields and how to create them here.

Finding the machine name of your post type is easy. Navigate to the list of your entries and the post type will be displayed in the URL.

Here's an example for pages:

You would want to end up with something like this. Take note of your Field API key, You'll need it in step 2.

Step 2. You can now select which post type you want to publish to on StoryChief, next you need to tell your WordPress website how to understand this custom field.
In order to do so you would want to paste in the following code snippet on your theme's functions.php file (or create a custom plugin for it if you prefer). Don't forget to paste in your Field API key from step 1.

* Define the post type at run time from a custom field.
* @param string $post_type The default type defined in the plugin settings
* @param array $payload The incoming payload from StoryChief
* @return string
function MYTHEME_storychief_change_post_type( $post_type, $payload ) {

$index = array_search($MY_FIELD_API_KEY, array_column($payload['custom_fields'], 'key'));

// Return default value if the custom field is not present
if($index === false) {
return $post_type;

$payload_post_type = $payload['custom_fields'][$index]['value'];
return empty($payload_post_type) ? $post_type : $payload_post_type;
add_filter( 'storychief_change_post_type', 'MYTHEME_storychief_change_post_type', 10, 2);

πŸŽ‰ You're done! That's all there is to it, you can now choose to either publish an article to your news section or your blog section.

πŸ“š Next steps

Did this answer your question?