get_the_title & wp_json_encode outputting [&-#8217;] instead of [‘]
-
Hi,
I am using this code:
for($x = 0;$x<100;$x++) { $list_array[ $x ]['year'] = get_post_meta($list_posts[$x], 'copyrightyear', true); $list_array[ $x ]['imdb'] = get_post_meta($list_posts[$x], 'imdb_rating', true); $list_array[ $x ]['title'] = get_the_title($list_posts[$x]); $list_array[ $x ]['url'] = get_the_permalink($list_posts[$x]); } echo wp_json_encode( array( 'items' => $list_array ) ); return wp_json_encode( array( 'items' => $list_array ) );I have tried esc_html(get_the_title($list_posts[$x])); as well.
But somehow the output is not showing the correct format. It’s showing [&-#8217;], [&-#038;], etc.
How do I modify the output?
Regards- This topic was modified 4 years, 10 months ago by . Reason: Have added hypen in code to show the problem
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘get_the_title & wp_json_encode outputting [&-#8217;] instead of [‘]’ is closed to new replies.