Any idea how I can use the WP function get_page_by_title()
with qTranslate installed?
for example:
$page_contact = get_page_by_title( '_e("[:en]contact");' ,'page' );
$page_contact_ID = $page_contact->ID; echo '~~~~'.$page_contact_ID;
The only way I can get a match is by including the whole string with all the languages – and there is no way that’s going to work once people start editing the pages…
Ok, now that you know your final goal I can try to answer :
first , A little background for other people who will read this and might wonder why this question exists (because it can help also in other cases )
the function get_page_by_title() does exactly what the name say . But qTarnslate , as well as other plugins , actually CHANGE the title in the DB .
The answer to such problems is using another less-known (but not less powerful) function called
get_page_by_path();
why does this help ? Because the Path of the page will not be changed .
Usually it will be used like this :
But a much more cool thing is that the “path” parameter can be the SLUG , which is NOT changed by qTranslate .
so for the direct answer , please try this :
that being said, and as a side note – there is no reason for you to lose the ID of pages when migration, if you simply export your DB and import to the new server , like described in the CODEX or HERE.