I need to modify older website which I didn’t create and I have this very simple code which should get posts by post_parent – it doesn’t matter which language is currently active. It works when language is Croatian but for English it doesn’t find any pages. Any solution for this?

$args = array(
    'post_type'      => 'page',
    'post_status'    => 'publish',
    'posts_per_page' => -1, 
    'post_parent'    => 5455, 
    );
$parent = new WP_Query( $args );

if($parent->have_posts()) {
    echo 'it works wow';
}       

Read more here: How to get pages by same post_parent in both languages (WPML)?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: