Monday, February 29, 2016

wp - setup_postdata($post2) wont work

It has to be

global $post;


otherwise, you might get wrong link in the_excerpt and so on


If it redirects to the other version of the post, make sure you check .htaccess and any of the REDIRECT plugins.

Also, it can be caused by the non-unique slug!


In some configurations (probably  due to what is being translated by WPML ), if get_field("name", post_id) fails, the original content can  be obtained by:

get_field("name", $orig_lang_id);

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...