Possible Fix for WPML
-
I found a potential fix for the compatibility problem with WPML.
There was an error in the SQL query from the core get_adjacent_post() call.
Instead in looking in the correct element_type, it was consistently looking for a post_post in the wpx_icl_translations table.The fix is to modify the original get_adjacent_post() from the /wp-includes/link-template.php file and add the new function to the class.post-navigator.php
for example I named mine public static function get_adjacent_any_post(…)
and after the line
$join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms );
I added the following
$join = str_replace("post_post", "post_".$post->post_type, $join); $join = str_replace("'post'", "'".$post->post_type."'", $join);
And now the Next and Previous buttons appear on every post, page and custom post type edition page !
hope this helps !
- The topic ‘Possible Fix for WPML’ is closed to new replies.