Home › Toolset Professional Support › [Resolved] Content items have inexplicably disappeared
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.
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)
Related documentation:
This topic contains 10 replies, has 2 voices.
Last updated by Christian Cox 4 years, 2 months ago.
Assisted by: Christian Cox.
Several of the content items I have created have disappeared from my website, even though they were on there for more than a year and were there roughly three months ago.
For example, on my page Russia Books, the book "The Master and Margarita" used to be on there but no longer shows on the front end, even though it is marked as published on the back end. Several other books are also missing from the front end, although I have made no changes to the database.
This is the third ticket I am submitting in the last three months. However, I did so under a different account. I wanted to let you know in case the previous tickets offered a clue as to what is happening and why my website inexplicably changed even though I did not touch the code.
Hello, I will be glad to take a closer look. Can you provide links to the previous tickets so I can see the history here, or let me know the previous profile you used to submit the tickets?
Can you provide login credentials so I can check the setup in wp-admin?
It looks like the Books post type option "publicly_queryable" was disabled in Toolset > Post Types > Books (screenshot attached). When disabled, you'll see no permalinks in the Book posts and in the Books dashboard, the "View" link will not be displayed. I have activated this option and now I can see Book posts on the front-end of the site, for example: hidden link
I do not see a Page with the title "Russia", but I see an archive for the Russia tag here: hidden link
I see a couple of Books appear there now. Please let me know if the issue is not completely resolved now.
I do not want books to show as individual content types on the front end. I only want them to show in relation to a country. For example:
hidden link
The above page used to show the book "The Master and Margarita"; it no longer does and I did not change any settings to cause this to happen. Several other books have disappeared from country pages. I do not know why.
I have not changed any settings/coding in Toolset in several months. All I have done is add some content. Yet the issues I mentioned, including the one in this and the two previous tickets, show me that something was changed, just not by my hand. I want to make sure this does not happen again as it severely impacted the traffic to my site. I also need to get the content back to the way it was, which means finding out why books have disappeared from their country pages.
I do not want books to show as individual content types on the front end. I only want them to show in relation to a country.
Okay I apologize, I did not realize this was intentional and I misunderstood the requirement. I have turned off publicly_queryable to revert to the previous state. I believe I have resolved the problem in the Russia page you mentioned here:
hidden link
The View showing those Books is here:
hidden link
I turned on Views debugging temporarily and noticed that the View was finding 5 results, but only 3 were displayed. After a bit of digging I found the problem was in the loop template, which can be edited in the Block Editor here:
hidden link
The bottom shortcode block contained a bit of HTML with shortcodes and conditionals, but the content had become corrupted somehow. The second screenshot attached here shows the block editor after I clicked "Attempt recovery" on the corrupted block. Several quotation marks were being converted to their HTML entity equivalents, effectively leaving the conditional open-ended. The net impact: every other result in the View appeared to be "skipped" because of corrupted HTML markup.
To fix that, I replaced the shortcode block with a custom HTML block, which handles nested shortcodes and conditional statements more effectively without corrupting the contents during editing/saving. I added some line breaks and spacing so I could see the markup nesting structure a bit more clearly, then cleaned up some of the nested quotation marks and HTML markup a bit to prevent further corruption. The href attribute of the "a" tag in the last conditional was completely lost in the corruption. Based on the conditional, it looks like you want to display a link to the URL in the custom field book-public-domain-url, with the link text coming from the book-public-domain-source-name custom field. The conditional is testing if the URL custom field has some value, to prevent displaying a dead link with no URL. I assumed the URL field in the conditional criteria is the URL you want to use in the link's href attribute, so that's how I set it up. If that is not correct, please let me know so I can make the necessary adjustments in the template editor. Or feel free to adjust it yourself if you want.
Now the content of the custom HTML block is as follows:
<p style="clear: left;"> <a href="[types field='book-amazon-url' output='raw'][/types]" target="_blank" rel="noopener noreferrer"> <img style="width: 130px;" src="<em><u>hidden link</u></em>"> </a> [wpv-conditional if="( $(wpcf-indiebound-url) eq '' )" evaluate="false"] <a href="[types field='indiebound-url' output='raw'][/types]" target="_blank" rel="noopener noreferrer"> <img style="height: 50px;" src="<em><u>hidden link</u></em>"> </a> [/wpv-conditional] [wpv-conditional if="( $(wpcf-book-public-domain-url) eq '' )" evaluate="false"] <a href="[types field='book-public-domain-url' output='raw'][/types]" class="btn" rel="noopener noreferrer"> [types field='book-public-domain-source-name'][/types] </a> [/wpv-conditional] </p> <hr style="margin: 5px 0; border: 15px solid white;">
I see The Master and Margarita, and A Gentleman in Moscow, now in the Russia page. See the first screenshot attached here.
Diagnosis: I believe that the Block Editor Loop Template was created originally with the correct code in a shortcode block. It worked correctly for some time, but then I believe the template was edited at some point. When the editor page loaded, the shortcode block failed to convert some nested shortcodes or conditional statements or quotation marks correctly, and introduced the quotation mark corruption shown in the screenshot here. It would have been easily overlooked by anyone who made a minor change to another part of the template. That corruption was saved along with a minor edit, a block configuration change, or something similar. Thats my best guess as to how the problem began, but I can't really say without knowing the full history of the template here. At any rate, the new custom HTML block seems more stable. The contents are not corrupted anymore when I reload the editor after saving changes.
Let me know if I've missed something and I can take another look.
Thank you for your help with that. My concern, as mentioned earlier, is that these bugs keep cropping up, even though no one has changed the templates. I have had to open three separate tickets in as many months due to the code inexplicably changing, so I want to try to figure out what is causing this issue so it does not occur again.
In looking at the Russia page, I see some new issues; I'm unsure if they are related to the changes you made, but they were definitely not there a few weeks ago:
* An extra space between the referrer's name and comma (ex: after "Shannon McClatchey")
* Book title is not aligned with the top of the book cover image; this appears to be resulting in extra space below the book cover.
* Extra space between elements, such as between the book title and author name, author name and category, etc.
What could be causing the issues to crop up when the code hasn't been touched? Is there anything outside of Toolset that could be causing this?
* An extra space between the referrer's name and comma (ex: after "Shannon McClatchey")
* Book title is not aligned with the top of the book cover image; this appears to be resulting in extra space below the book cover
* Extra space between elements, such as between the book title and author name, author name and category, etc.
This seems to be happening because extra spaces were inserted in the content, and paragraph tags were added automatically wrapping individual elements. This can happen when toggling between Visual and HTML mode in a Fields and Text block with complex content, unfortunately, so I don't recommend using Fields and Text blocks when you want to maintain HTML tag-level precise control over the content. I suggest another Custom HTML block here instead of Fields and Text block. I've made that change and removed extra spaces and wrapping paragraph tags from the content. If I need to add any back, please let me know.
Thanks, but I don't see any change to the content. It looks exactly the same to me.
Thanks, but I don't see any change to the content. It looks exactly the same to me.
I temporarily reverted the changes, took a "before" screenshot, then reapplied the changes and took an "after" screenshot. It looks quite different to me - screenshots attached here. We must be looking at different things, or seeing different cached versions of the page for some reason. I addressed the issues on the Russia page, where you said you saw the problems: hidden link
Can you take screenshot or screenshots showing the entire screen I can use to compare?
Template code before:
<hr style="margin: 15px 0; border: 1px solid white;"> <p><a target="_blank" rel="noopener noreferrer"><span style="float: left; margin-right: 15px; width: 150px; margin-bottom: 15px; clear: left;">[types field='book-cover-image-new' title='%%TITLE%%' alt='%%ALT%%' size='custom' height='300px' resize='proportional'][/types]</span></a></p> <h2 style="font-style: italic; font-weight: bold; color: #bd3632; font-size: 20px; margin-bottom: 0;">[types field='book-title'][/types]</h2> <p>[wpv-view name="view-all-authors"]</p> <p><span style="font-size: 10px; font-weight: bold; color: black; margin-bottom: 15px; text-transform: uppercase;">CATEGORIES: [wpv-post-taxonomy type="book-category" format="name" separator=" | "]</span></p> <p>[types field='book-description-new'][/types]</p> <p>[wpv-conditional if="( $(wpcf-book-recommender).item(@recommender-book.parent) ne '' )"](Recommended by <a href="[types field='book-recommender-link' output='raw' item='@recommender-book.parent'][/types]">[types field='book-recommender' item='@recommender-book.parent'][/types]</a>[wpv-conditional if="( $(wpcf-recommender-title).item(@recommender-book.parent) eq '' )" evaluate="false"], [types field='recommender-title' item='@recommender-book.parent'][/types] [/wpv-conditional] ) [/wpv-conditional]</p>
Template code after:
<hr style="margin: 15px 0; border: 1px solid white;"> <a target="_blank" rel="noopener noreferrer"><span style="float: left; margin-right: 15px; width: 150px; margin-bottom: 15px; clear: left;">[types field='book-cover-image-new' title='%%TITLE%%' alt='%%ALT%%' size='custom' height='300px' resize='proportional'][/types]</span></a> <h2 style="font-style: italic; font-weight: bold; color: #bd3632; font-size: 20px; margin-bottom: 0;">[types field='book-title'][/types]</h2> [wpv-view name="view-all-authors"] <span style="font-size: 10px; font-weight: bold; color: black; margin-bottom: 15px; text-transform: uppercase;">CATEGORIES: [wpv-post-taxonomy type="book-category" format="name" separator=" | "]</span> [types field='book-description-new'][/types] [wpv-conditional if="( $(wpcf-book-recommender).item(@recommender-book.parent) ne '' )"](Recommended by <a href="[types field='book-recommender-link' output='raw' item='@recommender-book.parent'][/types]">[types field='book-recommender' item='@recommender-book.parent'][/types]</a>[wpv-conditional if="( $(wpcf-recommender-title).item(@recommender-book.parent) eq '' )" evaluate="false"], [types field='recommender-title' item='@recommender-book.parent'][/types][/wpv-conditional])[/wpv-conditional]
I also purged the SG Cache, though I'm not sure if it could have been responsible for the differences in our results. I checked logged-in and logged-out, and I see the same results in both cases.
FYI - when visiting this page in Firefox in a logged-out tab, several images are missing. I see mixed active content errors for the missing images, indicating the image tag src attributes use http even though the site loads on https by default in my browser:
hidden link
hidden link
hidden link
hidden link
hidden link
I can see the Amazon and Indiebound image URLs are hard-coded in the second custom HTML block of the Content Template, and should be updated to use the appropriate HTTPS protocol. Not sure about the others, though. Thought you would want to be made aware of this issue.
The spacing issue seems to have resolved. Looks much better — the way I had it a few months ago. Thank you!
Thank you for letting me know about the image issues. I will change those URLs in the template to include https.
Could you please let me know what may have called these issues to crop up after all these months? I know you mentioned the toggling between views, but I haven't even done that; I've gone nowhere near the code in months. I'm trying to prevent this from happening again.
Could you please let me know what may have called these issues to crop up after all these months? I know you mentioned the toggling between views, but I haven't even done that; I've gone nowhere near the code in months.
It wouldn't have even taken a change to the code. Anyone or anything that triggered a "save" for any reason on this template could have saved the corrupted data. If not you, then someone else. It's still my best guess, and I do not have any additional speculation to offer. Do you have backups of the site from the time before the problems began and a time when the problem could be seen on the site? If not, I would be wasting your time and mine - it would be better spent setting up periodic backups of the site for use in the future to offer more accurate problem diagnosis by comparing the site files and database over time.