Shortcode no longer works

So when I first started playing with this app shortcodes worked fine. However now I’m finding that sometimes the shortcode works, sometimes not. These two codes seem to work consistently:

    [s2Member-Profile /]
    [s2Eot /] 

This doesn’t work at all:

Hi there: [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
Access label: [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]

This works sometimes:

[s2If current_user_is(s2member_level0)]
Some words level 0
 [/s2If] 

See test page:
https://www.vdmna.com/dev1/

FYI 6 Active plugins on the site:

Bluehost
Custom Google Analytics Plugin
Gutenberg
Jetpack
Really Simple SSL
s2Member Framework

I did have Insert PHP Code Snippet and bbpress installed but I deactivated them and cleared my cache for testing purposes. No change.

I see from the forums that plenty of other people have had this problem but no answers other than ‘turn off your plugins’ … any known conflicts with the ones I’m running? I can’t really turn any of them off.

Thanks

btw the same conditional statement on a different page (the welcome page) does not work. It just displays the code.

How are you adding the shortcode to the page? Could the code have been broken/corrupted somehow?

When you say it works and sometimes not, did you notice any correlation with the login session?

I saw no correlation. Logged in, logged out, etc. Sometimes it works, sometimes it doesn’t. I dont know how I can break the short code. Did you visit the url?

I’m just using PHP to get around it but wish it worked out of the box :frowning:

Yes, I visited the URL and am shown the shortcodes. My first thought was that s2Member was not enabled, but I looked in the source code of the page and I see the s2Member CSS and JS are there, so it is enabled.

That’s why I thought maybe the code was changed in some way. I remember years ago pasting HTML in the Visual editor in WP and it messing up the code with the encoding, so I guessed it may not be impossible that something like that could have happened with the shortcode. But it’s very unlikely, WP knows about its shortcodes. And I just checked Gutenberg to verify what blocks the shortcode will work fine in, and see that Paragraph, Custom HTML, Shortcode, Classic, all parse the shortcode correctly.

I couldn’t reproduce your problem in my installation of WordPress.

You could try troubleshooting plugin/theme conflict… Maybe this will help make it easier: https://wordpress.org/plugins/health-check/

Let me know how it goes. :slight_smile:

If it is intermittent then it could be a stale cache. Clear your browser cache, CDN cache, host cache.

Having said that, if you see a shortcode then it is a server side php-rendering issue (where the shortcode is parsed).

If you are using the Gutenberg editor expect flaky operation with 3rd party blocks and even some core blocks. Test comprehensively on every major release for a while…WordPress continues to make substantial changes to the core that potentially impacts any theme especially older themes.

Regarding your specific problem…

From the debugger is looks like you are using the Gutenberg editor.

If so then be aware that shortcodes are not rendered in any core block other than the Classic and Shortcode core blocks. 3rd party blocks may or may not render shortcodes.

Caveat: I have had more consistent operation of shortcodes in the core Classic block than the core Shortcodes block.

What type of block are you using?

NOTE: If you just started typing without explicitly selecting a specific block type then you are typing in a text block (which is the default block type) and shortcodes are rendered as text in a text block.

Hope that helps. Let us know.

Cheers, Tim

2 Likes

Thanks for all the info. I didn’t realize there was a shortcode block option in Gutenburg. I will use that moving forward. Right now shortcode seems to be working so a caching issue I guess could be the problem, but not sure why it cached non-working code at all. I am re-familiarizing myself with Wordpress after a few years of retirement so, lots to learn

Thanks again, things seem to be working now.

Shannon

1 Like

Glad it’s working. It would be good to update us if this becomes flaky again. I’m collecting input w.r.t. Gutenberg stability.

Regarding caches, if you are on any of the Managed providers (GoDaddy, WordPress.com, etc) they have a lot of aggressive caching behind the scenes. I have experienced some weird client-side artefacts until I clear all the caches after a page edit. Their cache flushes are reasonably quick but there may be a time delay until the client settles back down. So I usually do site changes at off-peak times to minimise end-user impact.

1 Like