• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED Wordpress Banner not showing for pages with PHP code snippets

Messages
12
Likes
0
Points
1
#1
When I load pages where there is a snippet short code specified, the Wordpress banner doesn't show. If I select a different page, the banner appears. I also have a bunch of other problems that seem to be related to the snippets but this is the only one directly related.
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#2
Hello.

What is Wordpress banner?
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#4
Does removing the shortcode from the text solve the problem?
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#7
Your snippets have PHP errors in their code. To solve them, enable debugging mode in Wordpress, then you can see error messages.
Debugging in WordPress
 
Messages
12
Likes
0
Points
1
#8
Hi Temyk,
Thanks for letting me know about DEBUG. I can't believe that after all these years I never felt I needed it and never knew about it.

I turned on DEBUG and got this message.
Deprecated: Function create_function() is deprecated in /home/canadi31/public_html/wp-content/plugins/php-code-widget/execphp.php on line 62

I assume php-code-widget has nothing to do with you guys but I still have some code using that plugin.

I'm sure these errors existed for a long time but I never experienced this problem before installing Woody Snippets.
I'd like to uninstall/remove Woody Snippets as a test so I can find out what's going on.
Will my snippets be removed if I uninstall/remove Woody Snippets.

Thanks, Dave.
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#9
When you delete a plugin, snippets are saved. This can be configured in woody's settings. Check it.

Still, there is an error in the snippet code. After you enabled DEBUG, did you add shortcodes to the page and update it?
 
Messages
12
Likes
0
Points
1
#10
After enabling DEBUG I found out that the errors was not in my Woody Snippet code, but actually in a plugin called PHP-Code-Widget caused by the deprecated PHP function create_function(). After fixing that, I found out that this error was also in the Slider Revolution plugin. I have a feeling that I'm going to find this error in other plugins too.

I also noticed that this problem did not happen with every page that had a Woody Snippet shortcode so I'll investigate that. I have about 5 other WordPress problems which I believe might be associated with this deprecated PHP function.

I will spend some time over the next few days to try to diagnose what's actually happening.

Thanks for your help so far. If you have any suggestions please let me know, and if I can pinpoint the problem, I'll let you know.
Dave.
 
Messages
12
Likes
0
Points
1
#11
I have found the problem. It happens if the snippet is stopped as a result of the die() or exit() functions. It did not seem to be related to the errors resulting from the deprecated PHP create_function(). I can see how this could create a problem since it's actually causing Wordpress to die.

My solution is to remove those statements where possible or implement work-around logic to avoid using those statements. If this is something that could be made to work within Woody Snippets, please let me know.

Thanks,
Dave.
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#12
Instead of die() or exit() you should use return;
Or build code logic so that you don't need to interrupt code execution.
 
Messages
12
Likes
0
Points
1
#13
I was only aware of that usage in functions. I'll try it in the main program.
Thank you for your help.
Dave.