ellmann creative
Forum Replies Created
-
Also,
is_admin
checks if the page is the administrative interface (i.e. /wp-admin).is_super_admin
checks if the USER has super-admin capabilities. Why are you mixing the two?This mix of “or” will make this ajax fire on the website’s front-end, IF the user is a super-administator…
You should fix that by changing
is_admin() or is_super_admin()
(which isn’t what you want) tois_admin() and current_user_can("install_plugins")
or something similar (current_user_can()
always returns true for super-admin).- This reply was modified 1 year, 11 months ago by ellmann creative.
Thank you. It seems to be OK now.
@azofai There should be a message about it being auto-disabled due to your installation not being affected by the bug this fix is for (or whatever other issue it detected that caused it to auto-disable).
You need to have both Polylang and WPBakery enabled, and the script must detect that there’s an issue when returning media. If it auto-disables, you either don’t meet these criteria, or you have a different issue.
Thank you for explaining the issue further. Much appreciated.
The simplest method is:
a) create a new folder in wp-content/plugins/; name it
polylang-wpbakery-image-compatibility-fix
b) inside the new folder, create a new text file namedpolylang-wpbakery-image-compatibility-fix.php
c) copy the code verbatim into the text fileRemember to enable the plugin in your Plugins. The plugin should auto-disable itself if the function is removed or changed to return the original ID by default.
Okay, so I have a testbed WP install, and I replicated all plugins we’re commonly using.
It looks like the issue is triggered when Sucuri Security is also active… but that’s not the whole story. I deactivated all plugins, then re-activated them again… and the problem is gone on the test site – I can’t re-trigger it now.
Conversely, on the staging and live sites, the problem is still there regardless of what I deactivate and reactivate.
It’s one of those issues.
@robert681 the only component I removed is the full folder path to WP’s installation. Everything else is provided as it was reported by the webserver.
I can confirm this issue is present everywhere with WSAL for Woo at version v1.4.0. Not sure if it was present before, but it’s showing up in all of my installs now.
Current solution is to disable the plugin and wait for a new version. Haven’t tried rolling back to see when the issue first started.
Forum: Plugins
In reply to: [Polylang] Images not showing in one of the languagesNOTE: I’m not a support/developer person for this plugin.
There probably is, but I don’t actually know (never had to do this), and it could have potential side-effects (like data loss).
Forum: Plugins
In reply to: [Polylang] Images not showing in one of the languagesIf you had Media Library translation enabled, your images now are either in Russian or Ukrainian.
Ukrainian images won’t work for Russian pages, and vice versa.
Enabling/disabling ML translation won’t change anything, as the images already have the metadata attached to them, and turning it on/off doesn’t remove or change it.
If you want to remove the language categorisation for images, the simplest and safest way will be to disable Media Library translation, and then remove and re-add all media.
@cocciolina I’m glad that it solved the problem.
Here’s hoping for a solution from the Polylang team down the line. ??
Forum: Plugins
In reply to: [Polylang] Display a particular post in all/multiple languages@andreyostr unfortunately it looks like Polylang doesn’t see a “middle ground” here. Your post (or category, or taxonomy, or…) either is managed by Polylang and has a language set, or isn’t managed by Polylang and doesn’t have a language set. There’s no middle ground where you can have most of the posts managed, but have a subset unmanaged. It’s either/or, and from what I can tell (at least in the free version of the plugin), there’s no way to exempt specific post types from Polylang management.
The only solution I currently see (without going really deep into it) would be to write a plugin providing a shortcode that ignores Polylang (and most of WP, since the filters in play would affect it) entirely, fetches the required components from the database, and proceeds to display whatever content you enforce. This plugin would likely need to reinvent a lot of automation however, since all of the existing WP automation would be subject to Polylang’s filtering.
If anyone’s interested, I’ve written a small plugin that fixes the issue, at least for now:
https://home.kadtech.info/php-sources/polylang-fix/js_composer_polylang_image_fix.phps
Actually, this isn’t a WPBakery issue at all, methinks.
I tracked the issue down, and the problem happens in a WPBakery function, true, but this code is the culprit:
$attach_id = apply_filters( 'wpml_object_id', $attach_id );
With Polylang enabled, the result of this is NULL, which then causes
get_post()
to return the current page instead of the attachment, and it breaks from there.What plugin, apart from WPML, might be touching that filter, hmm? ;]
Incidentally, adding in
add_action('init', function(){ remove_filter('wpml_object_id', 'icl_object_id', 10, 4); });
– resolves the problem (but also likely disabled the associated functionality).
I think that in
wpml-legacy-api.php
, on line 170:function icl_object_id( $id, $type = 'post', $return_original_if_missing = false, $lang = '' ) {
if you detect that the post type is
attachment
and the user did NOT enable Media Library translations,$return_original_if_missing
should be switched totrue
and the original ID returned, like so:if ( 'attachment' === get_post_type( $id ) && get_option('polylang')['media_support'] === false ){ $return_original_if_missing = true; }
- This reply was modified 2 years, 8 months ago by ellmann creative.
- This reply was modified 2 years, 8 months ago by ellmann creative.
- This reply was modified 2 years, 8 months ago by ellmann creative. Reason: Added solution code
This is clear, but I need to be able to edit these buttons/texts now. The legal deadline to have this implemented is 31st of March, and we’ll need to have the website passed onto the client before then (ideally, this Friday).
Is there anything I can do?
Also, does this method of split translation work well with language plugins like Polylang?
- This reply was modified 2 years, 8 months ago by ellmann creative. Reason: Added an extra question / related