Created
September 15, 2021 14:07
-
-
Save andrii-kvlnko/988ef83e7211a2efabb1e26b650892eb to your computer and use it in GitHub Desktop.
WordPress | Polylang | Set languages to all posts
This file contains 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
add_action( 'wp', function () { | |
$posts = get_posts( | |
[ | |
'post_type' => 'post', | |
'lang' => '', | |
'paged' => 1, | |
'posts_per_page' => - 1, | |
] | |
); | |
foreach ( $posts as $post ) { | |
pll_set_post_language( $post->ID, 'ru' ); | |
dump( $post->ID ); | |
} | |
exit; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment