markomiljanovic
Forum Replies Created
-
Hi @peopleinside,
Thank you for reaching out.
You’re right that there’s an issue here, though the cause is slightly different from the PHP opening tag itself. WPCode actually strips the leading
<?phpautomatically when you save a snippet, so that part isn’t the problem. The real culprit is thedeclare(strict_types=1)statement. PHP requires that declaration to be the very first statement in the entire script, and because WPCode runs your snippet inside its own execution context (alongside your other active snippets), that condition can never be met.For performance, WPCode runs your active PHP snippets together in a single execution pass, and this particular type of fatal error stops that whole pass before any of them get a chance to run.
The good news is the fix on your end is simple: you never need the
<?phptag or thedeclare(strict_types=1)line in a snippet manager. Just paste the actual code, like this:add_filter( 'shield/can_run_site_health_security', '__return_false' );WPCode handles the PHP context and execution for you, so the snippet will work exactly as intended without those leading lines.
I’ve also passed your suggestion along to our development team, automatically detecting and stripping a leftover declare statement (or warning about it) is a great idea. Thank you for taking the time to suggest it.
Let me know if I can provide more info.
Thanks,
Hi @peopleinside,
Thanks for following up.
The reason it can’t simply save your code when there’s an error comes down to how our protection works. When you save an active snippet, WPCode runs the code to ensure it won’t break your site. If that code would cause a fatal error, the execution is stopped right there to protect your site. Since this is a brand-new snippet that hasn’t been written to the database yet, stopping that process also interrupts the save itself. It’s the safety mechanism doing its job, albeit with the unfortunate side effect you encountered.
That said, we fully agree this experience can be better. Ideally, the snippet should save regardless and simply show you the error in the admin, ensuring nothing is ever lost. We’ll look into it and consider making this change. In the meantime, saving the snippet inactive first will reliably keep your code safe since saving without activating skips the code execution entirely.
Let me know if I can help with anything else!
Thanks,
Hi @peopleinside,
Thank you for contacting us, and I’m sorry to hear you’re experiencing this issue.
WPCode actually does have built-in protection for this. When you activate a snippet, it runs an activation check that executes the code first, and if it detects a fatal error, it blocks activation so the bad code can’t take your site down. The catch is the order of operations in your workflow: when you toggle the snippet to active and save at the same moment, the code runs during that same save request, so the fatal error can interrupt the request before the snippet finishes saving, which is why it feels like the code is lost.
The simple fix is to save first, activate second. Create your snippet, leave the toggle set to inactive, and click Save. That stores your code safely no matter what. Then flip the toggle to active, at that point, WPCode runs its check, and if the code has a fatal error, it will refuse to activate and show you the error right in the admin. Your code stays intact and editable so you can fix it.
As for the email, that’s actually WordPress core’s own “recovery mode” notification, not something WPCode sends.
Let me know if I can provide more info.
Thanks,
Hi @marcus1108,
Thanks for reaching out, and apologies for the trouble accessing our site, that was a temporary issue and it’s resolved now, so you can open a ticket through the contact form on wpconsent.com whenever you need.
Regarding the banner reappearing: once a visitor accepts or rejects, it should stay hidden. When it keeps showing, the usual cause is page caching, a caching plugin or host-level cache serving a version that doesn’t reflect the saved consent.
Clearing your site cache usually fixes it. It’s also worth testing in a fresh browser with no extensions: accept once, then browse a few pages, if it stays hidden there, the issue is caching or a plugin conflict rather than the plugin itself.
If it still reappears after that, please open a ticket through the form and we’ll dig in further.
Thanks,
Hi @jacobhaviland,
Thanks for the kind words, glad you’re enjoying WPCode!
There’s no need to combine them. Each snippet is just lightweight inline text, and WPCode outputs them all together in a single efficient pass, so ten separate snippets versus one combined makes no real difference to page speed. What actually affects speed is the external scripts each pixel loads from Google, Meta, and so on, and that’s the same either way.
Let me know if I can provide more info!
Thanks,
Thanks for reaching out.
The vulnerability your security plugin is reporting has already been patched in the latest version 2.3.6. Updating to that version will resolve the issue.
Thanks,
Hi @hommealone,
Thanks for the suggestion, I’ll pass it along to the team.
The process is identical in both editors, which is probably why we haven’t highlighted it separately. Each snippet you create in WPCode gets a shortcode like [wpcode id=”123″], and you just paste that shortcode into the page wherever you want it to appear, into a Shortcode block in the block editor, or directly into the content in the classic editor. Same steps either way.
You can also skip the manual step entirely with Auto Insert, which places the snippet automatically based on a location you pick (header, footer, before/after content, etc.). More on both approaches here: https://wpcode.com/docs/a-complete-guide-to-snippet-locations/.
Let me know if I can provide more info!
Thanks,
Hi @ramon302,
WPCode outputs your snippet code exactly as you paste it, so we don’t automatically add async or defer to script tags. If you’d like a script to load asynchronously, you’ll want to add async or defer directly to the tag yourself, like <script async src=”https://example.com/pixel.js“></script>.
Let me know if I can provide more info!
Thanks,
Hi @darlen3,
Good news, dark mode is already built in. You’ll find the toggle under WPCode > Settings in your WordPress admin. Just scroll down to the “Dark Mode” option, switch it on, and save changes.
From that point on, the code editor will use a darker theme across all your snippets and the Headers & Footers screen.
Thanks,
Hi @zane97,
Thank you!
No limit at all, you can add as many snippets as you’d like in the free version, with no cap on how many you create or keep active. All snippets are stored locally on your own site, so it’s entirely up to
you how many you want to build up over time.Let me know if you have any other questions.
Thanks,
Hi @zane97,
Thanks for the kind words!
With the free version, saving your own custom snippets to a personal collection isn’t possible.
This is available in WPCode Pro, which includes a feature called My Library: once your site is connected to your WPCode account, you can save any custom snippet to your personal cloud library and deploy it on your other connected sites with a single click. This feature is available in any subscription plan.
That said, the free version does include export/import for snippets, so you
can easily move them between sites or keep local backups by exporting from one site and importing on another.Let me know if you have any other questions.
Thanks,
- This reply was modified 1 month, 1 week ago by markomiljanovic.
Thanks for reaching out and glad you’re enjoying WPCode!
Unfortunately, “Device Type” (loading a snippet on mobile, tablet or desktop screen) is a Pro-only feature, so it isn’t available in the free version.
If you can share a bit more about what you’re trying to achieve and the snippet you’d like to load only on mobile, we might be able to suggest a solution.
Thanks,
Hi @mariel442,
It really depends on what the source recommends, so I’d suggest checking their instructions and placing the code wherever they specify. In general, though, there’s no real benefit to using one over the other for a small verification code.
Most verification providers (Google Search Console, Bing, Pinterest, etc.) specifically ask for the code to be placed in the section, in which case you’d want to use the Header field.
Let me know if I can provide more info!
Thanks,
Hi @karlykaiom,
Use the Header field for code that needs to load before the closing tag. The Footer field will output the script closer to the closing body tag.
Thanks,
Hi @pineapplepalm,
WPCode does not use JSONP. If you see
rest_jsonp_enabledwhen searching the codebase, that’s simply a WordPress hook name included in our Hooks Generator list (a label used in a dropdown), not something WPCode depends on at runtime. Disabling JSONP on your site will not affect WPCode.WPCode does not currently include a built-in option (similar to
DISALLOW_FILE_MODS) to lock snippet creation and editing across the board. This can be achieved with custom code, so please contact us and we’ll help you set it up: https://wpcode.com/contact.Thanks,