WPCode only saves HTML snippet (no PHP possible)
-
Hello,
I just installed the plugin WPCode and wanted to test the PHP snippet function. I create a new snippet, chose code type “PHP snippet”, add<?php
echo “Hello World”;
?>Then I save it and the plugin shows as code type “HTML snippet” and removes the “<?php” from the Code Preview window.
Does my installation not allow to use PHP snippets? Is there any hidden setting I have to activate to be able to save PHP snippets?
WP 6.0.3
WPCode 2.0.3Also, the pre-installed code snippet “Completely Disable Comments” shows as HTML snippet. But the code in this snippet looks more like PHP.
- This topic was modified 2 years, 1 month ago by dl1mgb. Reason: additional information
-
Hi @dl1mgb,
From what you’re describing it seems like the code type for snippets on your site is not being saved correctly. The “Completely Disable Comments” snippet is pre-installed as PHP so it might just be an issue with the dropdown where you select the code type.
Would it be possible to reach out using the form at https://wpcode.com/suggestions/ so that we can take a look at your site to figure out the issue?
Thanks
Obviously, my site is broken. I set up a new installation and at least this problem is solved. Now, I just have to get the “include” statement running…
Now I have one site where WPCode is working and two site where it only saves HTML snippets. I still can’t imagine that I am the only person in the world with this behaviour.
I deleted the plugin and reinstalled it. Still the same. And I learned that the plugin is not deinstalled. There are still remainings left (old snippets I created). Another strange behaviour.
Any solutions?
And I get this message in the backend when I press on the Button “Install” in them Plugin section:
Notice: Undefined property: stdClass::$plugin in /www/htdocs/w01d47f4/bavarian-contest-club.de/wp-includes/class-wp-list-util.php on line 167
Hi @dl1mgb,
From what you are describing regarding HTML snippets I have not encountered this before, my only guess would be that something interferes with the save process and prevents the taxonomy to be assigned correctly.
When deleting the plugin the snippets are not deleted as they are stored as posts and they won’t affect anything on your site – this makes it easy to run such diagnostics as you did. The plugin cleans up custom capabilities and other data it creates on uninstall.Regarding the other error – that doesn’t seem to be related to WPCode at all and it might be a server issue or a conflict with another plugin.
Do you have a staging site available which you could share access to for us in the same environment? If yes, please reach out using the form at https://wpcode.com/suggestions/ and we’ll try to help figure out the issue.
Thanks
Right now, I don’t have any site where people from outside can get access to. I also don’t understand, why all developers want to have immediate access to one’s backend if the plugin has a small hickup.
I might make a short movie showing the behaviour of the plugin if that helps to analyze the problem. Or we can arrange a Zoom or Skype call and I can show you it live.
I also deacivated all plugins one by another to see if there is any influence. Still same behaviour. There are also the same WP versions on all three systems. I only can imagine that deacivating doesn’t have any influence and there is still code in the back interfering with WPCode.
I also changed the theme on one system where WPCode is not working. Still the same.
Menu “Tools – Export”
The good installation says:Export Code Snippets
Code type
PHP Snippet (3)
Text Snippet (1)The “bad” system says:
Export Code Snippets
Code type
No snippets available to export.Though there are also 4 snippets in the “All Snippets” window.
Hi @dl1mgb,
Thank you for the details.
As I suspected, that means there is an issue creating the taxonomy terms used to separate the snippets by code type.
Is the auto-insert location saved if you use different locations or does that also always default to Site-Wide Header?
Auto-Insert:
When I switch to PHP Snippet and select Auto-Insert – Run Everywhere, then it switches back to Auto-insert – Site Wide Header.When I select Shortcode, then Shortcode is saved.
Can you please try saving with another location in HTML mode? Like Site-Wide footer, the Run Everywhere option is not available unless PHP is set so if that doesn’t work the location won’t work either.
Thank you
When I try to save a different value for Auto-Insert, it goes back to side wide header.
I don’t know who set this topic on “resolved”. It is far away from that.
Is there any solution in sight?
Is there an alternative to WP Code which allows to insert PHP Code like WP Code?
Hi @dl1mgb,
From what you are describing it sounds like none of the taxonomies used for storing WPCode snippets can be assigned correctly and this results in all snippets falling back to the default values (Code type HTML & Auto-Insert location Site Wide Header).
Can you please share the data under wp-admin > Code Snippets > Tools > System Info to try and replicate this behaviour on our end with a similar setup?
Are you able to assign categories to posts correctly?
Thanks
Hi Mircea,
below the info as reqeusted.
I am able to create and assign categories for posts and pages correctly and without problems. Also pages that show posts from certain categories show them correctly.
———
### Begin System Info ### -- Site Info Site URL: https://install.cqbcc.de Home URL: https://install.cqbcc.de Multisite: No -- WordPress Configuration Version: 6.0.3 Language: de_DE User Language: de_DE Permalink Structure: /%year%/%monthnum%/%postname%/ Active Theme: Hueman Pro 1.4.24 Show On Front: posts ABSPATH: /www/htdocs/w01d47f4/bavarian-contest-club.de/ Table Prefix: Length: 3 Status: Acceptable WP_DEBUG: Disabled Memory Limit: 40M Registered Post Stati: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed Revisions: Enabled -- WordPress Uploads/Constants WP_CONTENT_DIR: /www/htdocs/w01d47f4/bavarian-contest-club.de/wp-content WP_CONTENT_URL: https://install.cqbcc.de/wp-content UPLOADS: Not set wp_uploads_dir() path: /www/htdocs/w01d47f4/bavarian-contest-club.de/wp-content/uploads/2022/11 wp_uploads_dir() url: https://install.cqbcc.de/wp-content/uploads/2022/11 wp_uploads_dir() basedir: /www/htdocs/w01d47f4/bavarian-contest-club.de/wp-content/uploads wp_uploads_dir() baseurl: https://install.cqbcc.de/wp-content/uploads -- WordPress Active Plugins Broken Link Checker: 1.11.18 (needs update - 1.11.19) Classic Editor: 1.6.2 Classic Widgets: 0.3 EventON: 4.1.2 (needs update - 4.2.1) NextGEN Gallery: 3.30 NextGEN Plus: 1.12.0 Polylang: 3.2.8 PublishPress Future: 2.7.8 Real Category Management: 4.1.31 (needs update - 4.1.32) Real Media Library: 4.18.18 (needs update - 4.18.19) WPCode - Insert Headers, Footers, and Code Snippets: 2.0.3 -- WordPress Inactive Plugins -- Webserver Configuration PHP Version: 7.4.30 MySQL Version: 5.5.5 Webserver Info: Apache -- PHP Configuration Memory Limit: 256M Upload Max Size: 200M Post Max Size: 200M Upload Max Filesize: 200M Time Limit: 30 Max Input Vars: 3000 Display Errors: N/A -- PHP Extensions cURL: Supported fsockopen: Supported SOAP Client: Installed Suhosin: Not Installed -- Session Configuration Session: Disabled ### End System Info ###
- The topic ‘WPCode only saves HTML snippet (no PHP possible)’ is closed to new replies.