Get published posts and pages?


I’m working on a plugin to use gettext in posts and pages content.

I’m trying to get all published posts and pages in order scan them for translatable strings, but I cannot figure out how to do it.

This is what I’m trying:

$pages = $wpdb->query('SELECT * FROM wp_posts WHERE post_status = "publish"');
foreach ( $pages as $post ) {
Lisandro Vaccaro 1 month 0 Answers 9 views 0

Leave an answer