How to use WordPress Bogo with custom post types

WordPress Bogo is a plugin that provides multilingualization support, and by default it only covers standard post types such as posts and fixed pages. However, if you have custom post types on your site, you may want to treat these post types as multilingual as well.

The following code can be used to add custom post types as Bogo targets:

function my_localizable_post_types( $localizable ) { 
 $args = array( 
 'public' => true, 
 '_builtin' => false 
 ); 
 $custom_post_types = get_post_types( $ args ); 
 return array_merge( $localizable, $custom_post_types ); 
} 
add_filter( 'bogo_localizable_post_types', 'my_localizable_post_types', 10,. 1 );

This code takes the published custom post types and integrates them as targets for Bogo. Specifically, it uses the get_post_types function to retrieve the list of public custom post types and adds it to the Bogo_localizable_post_types filter.

Reference link: Qiita article

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top