Get published posts and pages?
Question
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 ) {
print_r($post);
}
0
1 month
0 Answers
9 views
0
Leave an answer
You must login or register to add a new answer .