Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Tirane (GMT+02:00)

This topic contains 10 replies, has 2 voices.

Last updated by Marsel Nikolli 1 year, 5 months ago.

Assisted by: Marsel Nikolli.

Author Posts
January 4, 2024 at 12:49 pm #15150546

cinnamontoast

Tell us what you are trying to do?
Users with editor roles can't edit some pages/posts, but administrators can

When I disable the WPML plugins, everything works great?

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No

What is the link to your site?
hidden link

Screenshot from 2024-01-04 15-46-53.png
January 4, 2024 at 2:36 pm #15151160

Marsel Nikolli

Hi,

Thank you for contacting WPML Support, I will be happy to help you.


1) Could you please tell me if this issue happens with post/page which that specific editor user created/translated or with other users post/page?

2) Is that the default WordPress editor user or a custom user based on it?

3) It might not be related but I noticed from the debug information that you are using WPML v.4.6.7, I'd suggest you update to the latest version v.4.6.8.

Looking forward to your reply.

Regards,
Marsel

January 4, 2024 at 5:54 pm #15152640

cinnamontoast

1) Could you please tell me if this issue happens with post/page which that specific editor user created/translated or with other users post/page?

It is quite inconsistent, because it sometimes it works if the user created the page/post, and sometimes it doesn't

2) Is that the default WordPress editor user or a custom user based on it?

Yes, it is the default WordPress editor

3) It might not be related but I noticed from the debug information that you are using WPML v.4.6.7, I'd suggest you update to the latest version v.4.6.8.

Yes, I upgraded but, the issue is still happening

January 5, 2024 at 8:17 am #15153372

Marsel Nikolli

Hi,

Thank you for the update.

Will it be possible to check if the issue happens in a minimal setup, that meaning using a default WP theme and keeping active only the WPML plugins active, and deactivating the rest of the plugins?

If the issue doesn't happen with only the WPML plugins active, then I would suggest activating the rest of the plugins one by one while monitoring if the issue happens when you activate a specific plugin.

That would help checking if there is any possible incompatibility issue going on.

Let me know if that works for you,
Marsel

January 9, 2024 at 4:00 pm #15165586

cinnamontoast

So, I managed to track down the issue to this file "plugins/sitepress-multilingual-cms/classes/url-handling/wpml-url-filters.class.php"

There is a method which registers global hooks called "public function add_global_hooks" and it has this line "add_filter( 'get_edit_post_link', [ $this, 'get_edit_post_link' ], 1, 3 )" in it

So, when I jump to the method "get_edit_post_link" which has the following code

```php
public function get_edit_post_link( $link, $id, $context = 'display' ) {
if ( $id && (bool) ( $lang = $this->post_translation->get_element_lang_code( $id ) ) === true ) {
$link .= ( 'display' === $context ? '&' : '&' ) . 'lang=' . $lang;
if ( ! did_action( 'wpml_pre_status_icon_display' ) ) {
do_action( 'wpml_pre_status_icon_display' );
}
$link = apply_filters( 'wpml_link_to_translation', $link, $id, $lang, $this->post_translation->get_element_trid( $id ) );
}

return $link;
}
```

Everything works great until it hits this particular method

But when I comment the following line

// $link = apply_filters( 'wpml_link_to_translation', $link, $id, $lang, $this->post_translation->get_element_trid( $id ) );

The links work just fine

Could you please help me understand what is changing in that particular call?

January 10, 2024 at 10:52 am #15168116

Marsel Nikolli

Hi,

Thank you for the update.

Could you please tell me if you were able to find out that the issue was being caused from that code in a minimal setup or in a normal setup of your website?

* If it was in a normal setup, could you please guide me through the steps you were able to debug the issue till the code you sent me?

Looking forward to your reply.

Thanks,
Marsel

January 11, 2024 at 2:10 pm #15175035

cinnamontoast

Hello,

So, it was in a normal set up

What I did is check how WordPress generates the edit link for the admin table listing, of which I found the function `get_edit_post_link` in `wp-includes/link-template.php` and it has this

```php
return apply_filters( 'get_edit_post_link', $link, $post->ID, $context );
```

So, I checked in the theme, and any plugins for any code that might be using/calling this hook

I didn't find it in the theme, so I went on the plugins and I found the hook being used in the `classic-editor` and `sitepress-multilingual-cms` plugin

I played around with the `classic-editor` plugin, and it didn't affect the edit link

When I went on to the `sitepress-multilingual-cms` plugin, I encountered the issue I sent in my previous reply

January 11, 2024 at 5:12 pm #15176017

Marsel Nikolli

Hi,

Thanks for the update, ould it be possible to check if the issue happens in a minimal setup, that meaning:

- keep the theme you have
- keep active only WPML Plugins and must have plugins to run the theme
- disable all other plugins

After, check if the issue is still happening.

Note: Please make sure you have a full backup (files & database) before trying anything on your website.

------

Also, in order to further troubleshoot the issue I would require a copy of your website to
further escalate the issue.

You can use the Duplicator plugin(https://wordpress.org/plugins/duplicator/) in order to create a copy of your website, and upload the backup on a file sharing website (Google Drive, Dropbox, etc.), please send me the link to download the backup after.

* Please try to minimize the size of the backup file by excluding unnecessary media files or backup folders that might be in the "/wp-content/" folder.

I’ve set your next reply as private in order for you to provide the Duplicator link.

Looking forward to your reply,
Marsel

January 12, 2024 at 3:22 pm #15179923

Marsel Nikolli

Hi,

Thank you for providing the Duplicator package.
I'll be doing some tests locally and then escalate further if the issue still persists.

Regards,
Marsel

January 23, 2024 at 8:17 am #15214540

cinnamontoast

Any feedback?

January 23, 2024 at 1:24 pm #15216956

Marsel Nikolli

Hi,

I do apologize for the delay, I did manage to test locally.

I created a new user "editor" and checked editing posts/pages without any problem, I noticed that when the user tries to edit the custom posts then it shows only a white screen.

Moving forward I suggest you follow these steps:

- Install plugin Advanced Custom Fields (ACF) Multilingual (https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/)
- The plugin "Advanced Custom Fields PRO" needs update, also please update any plugin/s that need update to the latest version

* On the duplicator page WPML is v.4.6.7, so please update to the latest version.

After, please check if issue persists and let me know.

---

Are there any steps we can follow to reproduce the issue (or any specific page/post that it happens always)?

Looking forward to your reply,
Marsel

The topic ‘[Closed] Users with editor roles can't edit some pages/posts, but administrators can’ is closed to new replies.