Skip Navigation

[Resolved] wordpress stripping apostrophe and replacing it with html breaking code

This support ticket is created 5 years, 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 17 replies, has 2 voices.

Last updated by Christian Cox 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1178212

There are many instances where similar to the following code w/in a Loop Item View, the apostrophes get automatically stripped out when re-opening the view page. This then makes the code inoperable. I've manually changed it within the View; and have tried bringing over entire code over to Notepad+ and pasted with same results.

<div id="spacing">
  [wpv-conditional if="( '[wpv-post-taxonomy type="product-list" format="count"]' >= '1' )"][wpv-post-taxonomy type="product-list" separator="<br>"][/wpv-post-taxonomy][/wpv-conditional]
</div>
<div id="spacing2">
  [wpv-conditional if="( '[wpv-post-taxonomy type="product-list" format="count"]' < '1' )"][wpv-view name="sup-category-archives-widget-list" limit="-1" orderby="title" order="asc" cached="off"][/wpv-conditional]
</div>

It is auto replaced with this:

<div id="spacing">
  [wpv-conditional if="( '[wpv-post-taxonomy type="product-list" format="count"]' >= '1' )"][wpv-post-taxonomy type="product-list" separator="<br>"][/wpv-post-taxonomy][/wpv-conditional]
</div>
<div id="spacing2">
  [wpv-conditional if="( '[wpv-post-taxonomy type="product-list" format="count"]' < '1' )"][wpv-view name="sup-category-archives-widget-list" limit="-1" orderby="title" order="asc" cached="off"][/wpv-conditional]
</div>

EDIT:
I noticed after I posted this, that your support system changed the code above in the 2nd instance. It took what I pasted ( ' ) and converted it to ( ' ).

#1178213

As well at the EDIT above. With spaces between charactcers this is what my views changes an apostrophe to: & # 0 3 9 ;

#1178576

Hi, it looks like you may have exceeded the maximum number of nested shortcode attributes that are supported by the system. Can you try the following troubleshooting steps?
- Update WordPress and Toolset plugins to the latest versions.
- Temporarily deactivate all plugins except Types and Views. Activate a default theme like Twenty Nineteen and test again.
- If the problem was resolved, reactivate your theme and other plugins one by one until the problem returns
- If the problem was not resolved, I'll take a closer look.

#1182377

you may have exceeded the maximum number of nested shortcode attributes that are supported by the system
Can you elaborate more on this limitation? What do we start eliminating (views, templates, posts, divs, shortcodes, forms, taxonomies, fields) to solve?

#1183115

I mean that there is a maximum number of levels of nested quotation marks. Otherwise, you end up repeating quotation marks inside themselves, which can cause problems. For example in your code above, the double quote before product-list could be interpreted as the end of the first "if" double quote mark, or the beginning of a nested quote mark pair. It can be a bit ambiguous to the parsing algorithm, so this is why there is a limitation on the levels of nesting in shortcode attributes.

A quick test can verify or exclude this as the source of the problem. Replace the wpv-post-taxonomy shortcode inside the conditional clause with hard-coded numbers, and replace the contents inside the conditionals with plain text, like this:

<div id="spacing">
  [wpv-conditional if="( '3' >= '1' )"]
    3 is greater than 1
  [/wpv-conditional]
</div>
<div id="spacing2">
  [wpv-conditional if="( '0' < '1' )"]
    0 is less than 1
  [/wpv-conditional]
</div>

Both conditionals will be true, and you should see both messages. If the quotation marks are still replaced incorrectly, then there is some other problem.

#1183139

Something much simpler like this one-liner will strip apostrophes upon a page refresh:

[types field='featured-product-image' size='full' style='width:150px; height:150px;'][/types]
#1183140

Your account will expire on 'xxx' and you will no longer be able to download Toolset or receive support. I take it our life membership was stripped as well?

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/my-lifetime-membership-has-been-converted-to-an-agency-membership/

#1183170

If something as simple as a Types field shortcode is not being shown correctly, that points to a different problem unrelated to nested shortcodes. Please try the following troubleshooting steps:
- Ensure WordPress and all Toolset plugins are up-to-date
- Temporarily deactivate all plugins except Types and Views, and activate a default theme like Twenty Nineteen. If you need to activate a Maintenance Mode plugin during testing, that's fine.
- Disable all custom code snippets in Toolset > Settings > Custom code
- Clear your browser cache and edit the View to insert a basic Types field shortcode once again. Save and refresh the page.
- If the problem is resolved, reactivate your custom code snippets, theme, and other plugins, one by one until the problem returns.
- If the problem is not resolved, I'll be glad to take a closer look.

I take it our life membership was stripped as well?
I've split this into a separate ticket and a supporter will follow up with you as soon as possible.

#1183660

I'll have to find a full day for this. Shutting down a multisite with over 100 sites on it isn't an easy/quick task.

#1183737

Yes that sounds like a nightmare on a live multisite network. If you can set up a staging site (non-network) and replicate the problem in a very simple implementation with minimal plugins or themes installed, that would be best for investigative purposes. Otherwise, a staging site that is a clone of the entire network is probably most practical.

#1185179

YES - Ensure WordPress and all Toolset plugins are up-to-date
DONE - Temporarily deactivate all plugins except Types and Views, and activate a default theme like Twenty Nineteen.
N/A - Disable all custom code snippets in Toolset > Settings > Custom code
TEST COMPLETE- Clear your browser cache and edit the View to insert a basic Types field shortcode once again. Save and refresh the page.
NOT RESOLVED - If the problem is resolved, reactivate your custom code snippets, theme, and other plugins, one by one until the problem returns.
WITH PLUGINS OFF AND A DIFFERENT THEME, the same stripping accured. Any ideas? Theme and plugins are back activated.

#1185254

We can try a few more things:
- Try logging in as a different User. I see another ticket in the forum related to this: https://toolset.com/forums/topic/code-in-views-template-apostrophe-reverts-to-039
- Try a different browser. Perhaps a browser extension is causing a problem in the editor screen.
- Export all Types and Views settings from Toolset > Export / Import, and upload them to Drive or Dropbox. Post a download link for me in your next reply.

#1185292

No change w/ Firefox, Chrome or IE11; or different Admin. I can give you (editor??) access to one of the sites. I don't have dropbox/other acct.

#1185332

The Editor role does not have access to the information I need. You could export the Types and Views information, upload the zip files to the site's media library, and provide download links for me.

#1185339

I have the two files, but this toolset site is public. My direct email is buildingdreams@earthlink.net where I can send credentials or files.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.