Skip Navigation

[Resolved] A code snippet you provided has an access warning when migrated to live site

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user is getting a warning on their custom snippet in Toolset -> Settings -> Custom Code

Solution:

In this users case they were missing the line of code to prevent direct access from the code.

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

Add the above to your code snippet and it should resolve this warning.

This support ticket is created 5 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by grahamA 5 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1193077
warning.jpg

I am trying to:
Migrate a code snippet you kindly provided (https://toolset.com/forums/topic/filter-a-view-with-no-relationship/) from my dev site to live site

Link to a page where the issue can be seen:
not available
I expected to see:

Instead, I got: status active Warning but the script does not work.
I have updated the toolset suite of plugins on the live site but the plugins are out of date on the dev site where the script works correctly.
Is there something new in your updates that prevent the script running? Can you see any other reason it would not work. The ID's that are referenced within the script are correctly transposed.
Many thanks

#1193175

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Graham,

To resolve this what you need to do is to add this line of code right after the comments line .


toolset_snippet_security_check() or die( 'Direct access is not allowed' );

Thanks,
Shane

#1193196

My issue is resolved now. Thank you! Brilliant ... and so quick, many thanks