X 7.0.2 / Cornerstone 4.0.2 / WPML 4.2.9: "Recent posts" all linking to the current post

In the sidebar menu of a blog entry, all “recent post” links link to the currently shown URL. This has been discussed in the WPML support forum and the work-around suggested there in January 2018 still seems to be necessary to make multi-lingual blogs work fine.

We needed to comment out add_filter( 'the_permalink', array( $this, 'filter_permalink' ) ); in the file cornerstone/includes/classes/components/class-wpml.php.

Unfortunately, this change will need to be repeated after every update. Any way to make this work by default?

Hi Stefan,

Thanks for reaching out.

It’s already fixed and I don’t see it happening anymore. And you don’t need to comment it out since it’s already disabled

    if ( apply_filters ( 'cs_enable_wpml_legacy_filters', '__return_false' ) ) {

      add_filter( 'the_title', array( $this, 'filter_title' ), 99, 2 );
      add_filter( 'the_permalink', array( $this, 'filter_permalink' ) );

    }

That’s disabled by default, and if you wish to enable it back then you have to add this line to your child theme’s functions.php

add_filter('cs_enable_wpml_legacy_filters', '__return_true');

It’s still better than commenting it out since anytime, user have option to enable it back without a need for editing the core files. If you’re still seeing that single line alone then your update is probably corrupted or incomplete. Please try deleting your cornerstone and re-install it back by visiting the validation page.

Thanks!

Hi @Rad,

Thanks for your input.

I think our Cornerstone installation is ok - I do see the code just as you posted it above, including the if condition. However, this condition evaluates to true - I’ve just tested it manually.

And FYI, there is no other place in the whole Wordpress installation where cs_enable_wpml_legacy_filters is used or set:

19-09-30 11:31]wp@wp:~/disk/wordpress% grep -r cs_enable_wpml_legacy_filters .
./wp-content/plugins/cornerstone/includes/classes/components/class-wpml.php:    if ( apply_filters ( 'cs_enable_wpml_legacy_filters', '__return_false' ) ) {

class-wpml.php is the only place where this identifier is being mentioned.

So maybe this isn’t “disabled by default”, as you said?

Cheers
Stefan

Hi Stefan,

I’ve been testing it on my end and it’s disabled, the value '__return_false' is what disables it. Would you mind providing your site’s URL and admin login credentials in the secure note?

Thanks!

Sure, here you go!

Hi Stefan,

I checked one of the blog pages and the Recent Posts widget works ok. Did you change the core? If yes, I suggest that you update the theme to version 7.0.3 and the Cornerstone to 4.0.3 and then get back to us if the problem re-appears.

Please do not change the core so that we can test the case on your installation.

Hi @christopher.amirian,

Thanks for looking into this.

At the moment you checked our blog, it only worked because of the work-around I had described above!

I have now updated to Cornerstone 4.0.3/X 7.0.3, which reset my work-around and you can again see the broken functionality. Simply test with the blog URL again which you sent to me in your secure note.

Thank you
Stefan

Hey Stefan,

I see that the issue persists even when activating the latest parent theme. I’ll post this in our issue tracker for further investigation. Please stay tuned.

Thanks.

Thank you, Christian. I will now re-enable the workaround on our page so that the links work for us.

You are most welcome!
Our developers have been informed already.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.