Last active
August 2, 2021 22:37
-
-
Save andrii-kvlnko/caeeb9c57cc4755c8cb03c694f5973ad to your computer and use it in GitHub Desktop.
WordPress | Polylang | Set all posts to default language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$posts = get_posts( | |
[ | |
'post_type' => 'post', | |
'numberposts' => - 1, | |
'lang' => '' | |
] | |
); | |
$posts_ids = wp_list_pluck( $posts, 'ID' ); | |
foreach ( $posts_ids as $post_id ) { | |
pll_set_post_language( $post_id, pll_default_language() ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment