Error with TOC plugin #1084
Replies: 3 comments 2 replies
-
Hi Douglas, I‘m currently two weeks off and cannot check it right now. But as far as i remember, you have added the TOC shortcode to the sidebar widget instead to the page content. For this case I created a filter to enable id‘s to all headings even if the TOC shortcode is not added to the content. I have added the filter to your child a few months ago. This might create issues with third party plugins. Please go to your child‘s functions.php and search for following filter: /**
* Enable adding IDs to all headings
*/
add_filter('bootscore/bs-toc/add-ids-to-all-headings', '__return_true'); Delete it and let me know if that errors are gone or not. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response (esp since you're on break). Removing that line of code did make the errors stop. Problem is once again it doesn't scroll: But this doesn't error: and no errors in the error log. username and pw - are webuser & ilovegold But we can leave this for now. Enjoy your break. I sure could use one.... |
Beta Was this translation helpful? Give feedback.
-
Let me explain and resolve ;-) The If the shortcode is added in a widget area or coded in a template, then it is outside the For this case, I wrote a filter that adds id's to all content headings, no matter if shortcode is present or not. In most cases this is fine. But, it tooks me some time to figure it out and I agree that must be written down more precise in the docs: Some third party plugins, for example the Events Calendar, hook into The solution is simple:
Both solutions leads into the same result on the frontend if the filter does not work in combination with another plugin. Sorry for the misunderstanding, it must written down clear that using the filter is a risk. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm getting a lot of these on/for pages that do not have bs-toc shortcode or any code adding a toc to the page:
2025/08/13 23:49:20 [error] 103935#103935: *2370 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /www/psbullion_836/public/wp-content/plugins/bs-toc/inc/toc.php:259
Stack trace:
#0 /www/psbullion_###/public/wp-content/plugins/bs-toc/inc/toc.php(259): DOMDocument->loadHTML('')
#1 /www/psbullion_###/public/wp-includes/class-wp-hook.php(324): add_ids_to_headings('')
#2 /www/psbullion_###/public/wp-includes/plugin.php(205): WP_Hook->apply_filters('', Array)
#3 /www/psbullion_###/public/wp-includes/formatting.php(3984): apply_filters('the_content', '')
#4 /www/psbullion_###/public/wp-includes/class-wp-hook.php(324): wp_trim_excerpt('', Object(WP_Post))
#5 /www/psbullion_###/public/wp-includes/plugin.php(205): WP_Hook->apply_filters('', Array)
#6 /www/psbullion_###/public/wp-includes/post-template.php(436): apply_filters('get_the_excerpt', '', Object(WP_Post))
#7 /www/psbullion_###/public/wp-content/plugins/wordpress-seo/src/helpers/post-helper.php(83): get_the_excerpt(Object(WP_P" while reading response header from upstream, client: 2600:100e:b04b:5238:5cab:2110:fb77:7c21, server: stg-psbullion-dev.kinsta.cloud, request: "GET /metals/silver/silver-bars/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/php8.4-fpm-psbullion.sock:", host: "stg-psbullion-dev.kinsta.cloud:64487", referrer: "https://stg-psbullion-dev.kinsta.cloud/metals/silver/"
This page errors:
pw: letmein
https://stg-psbullion-dev.kinsta.cloud/metals/silver/silver-bars/
But it's just a listing page with a woo products shortcode and the filter.
Should look like this:
https://psbullion.com/metals/silver/silver-bars/
I pushed my live site to dev which removed the login we set up. We can set that up again if it helps.
The errors are so bad I deactivated the plugin and will copy paste the one TOC in as HTML for that page.
Beta Was this translation helpful? Give feedback.
All reactions