Skip to content

Instantly share code, notes, and snippets.

@andrii-kvlnko
Created September 15, 2021 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrii-kvlnko/988ef83e7211a2efabb1e26b650892eb to your computer and use it in GitHub Desktop.
Save andrii-kvlnko/988ef83e7211a2efabb1e26b650892eb to your computer and use it in GitHub Desktop.
WordPress | Polylang | Set languages to all posts
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