Restore WordPress Backup Locally?

Jon, what kind of backup do you have? Often it is the sql statements that would be needed to recreate the content of the site. You could view them in a text editor to see what’s there. if you search for ‘posts’ for example you would find the insert statements to recreate the pages & … Read more

wordpress query returning unexpected results

First thing first, mind your formatting. Future you thanks you! Second, you’ve just got some weird array sticking around in your $args variable. I believe what you’re looking for is meta_query which takes “an array of arrays” to compare by. Third I believe you’re also looking for posts_per_page, not numberposts. posts_per_page is the record limiting … Read more

return child post if available otherwise parent post

You’d need at least 2 queries for this task, since it’s irregular. For example // collect all child posts $allChildPosts = get_posts([ ‘post_parent__not_in’ => [0], ‘posts_per_page’ => -1, ]); // list child posts and filter one post by parent id $childPosts = []; foreach ($allChildPosts as $post) { $childPosts[$post->post_parent] = $post; } // get all … Read more