Custom JS only visible to users with edit_posts capability
-
Hi, I think I’ve found a problem in the latest version of the Custom JS module of Master Addons.
In the current version of the file:
Current version:
https://plugins.trac.wordpress.org/browser/master-addons/trunk/inc/modules/custom-js/custom-js.phpthere are new permission checks inside both
jltma_page_custom_js()andjltma_element_custom_js():if (!current_user_can('edit_posts')) { return; }The issue is that this condition prevents any Custom JS from being printed on the frontend for public visitors.
Only logged-in users with the ability to edit posts can see the injected JS.In old version of the file (rev 3313604) (worked correctly):
Old version (rev 3313604):
https://plugins.trac.wordpress.org/browser/master-addons/trunk/inc/modules/custom-js/custom-js.php?rev=3313604these capability checks did not exist, and Custom JS was printed normally on the public frontend, similar to how Elementor Pro handles page-level and widget-level JS.
With the new checks in place:
- Page-level Custom JS
- Element-level Custom JS
…no longer runs for regular site visitors, which makes the feature unusable in production.
Could you confirm whether this change was intentional (for security reasons) or if it’s a regression?
Thank you for your work on the plugin!
-
Hi @alvarogarciar
Thank you for reporting the issue. We will look into it thoroughly. And we will fix it as soon as possible.Thank you again for detailing the issue.
Hi @kakon4366 ,
Thank you very much for the quick response.
I’ve seen that you included the fix in today’s update.
I’ve tested it and it works correctly.Thank you,
Best regards.Hello @alvarogarciar,
Thanks a lot for identifying the issue.
You’re right, we’ve fixed the issue and pushed update.
Please update Master Addons and test it.
If you face any issue please let us know.Update: Just seen that you’ve tested and it worked perfectly.
If you like our support please appreciate us by giving a 5 star review. It will encourage us a lot !
-
This reply was modified 2 months ago by
Liton Arefin.
Hi @litonice13 ,
Thank you very much for the quick fix.
I’ve updated Master Addons and tested it, and everything is working correctly now.Thanks again for the support.
Best regards.Hi @alvarogarciar,
Thanks for let us know.
If you like our support please don’t forget to give a 5 star review with some comments.
It will boost our productivity and encourage our team !Thanks
-
This reply was modified 2 months ago by
You must be logged in to reply to this topic.