Avatar of Howard Bash
Howard BashFlag for United States of America

asked on 

Wordpress htmlspecialchars error

When running wordpress XML Sitemap Generator, I sometimes get the following error "htmlspecialchars expects parameter 1 to be string php"

Please advise.
WordPressPHP

Avatar of undefined
Last Comment
Howard Bash
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Taken literally, it means that the plugin is trying to parse a variable using the htmlspecialchars() function but instead of a variable with a single value, it is encountering an array of values and choking on it.

Do you have any funky formatting anywhere where multiple content sources are aggregated into a single page (photo gallery, tabbed pages, etc)?  What other plugins are present?
Avatar of Howard Bash
Howard Bash
Flag of United States of America image

ASKER

No formatting done on my part.  The following are the active plugins:
Alexa Rank Widget
Embedded Video
Google XML Sitemaps
WordPress Database Backup
WP-ShortStat
WP-Stats
WP-UserOnline
WPTouch
Try disabling all plugins except XML site maps and see if the error happens.  Alternately, try replacing the XML plugin with a different XML plugin with all other plugins active and see if you still get the error
Avatar of Howard Bash
Howard Bash
Flag of United States of America image

ASKER

The error is shown in the XML Sitemaps setup page.  So removing it wouldn't make sense here.  I will disable the other plugins and get back with the results.
>>  So removing it wouldn't make sense here

I know that, which is why I said:

Try disabling all plugins except XML site maps
Avatar of Howard Bash
Howard Bash
Flag of United States of America image

ASKER

In the second sentence you write:

" Alternately, try replacing the XML plugin with a different XML plugin with all other plugins active and see if you still get the error "

Which prompted me to remark that as the error is within the plugin,  removing the XML plugin will remove the error...  

I'll let you know if the disabled plugins have an affect.
But the error may be in how WordPress is outputting an object to the XML file in which case you would get the error in every plugin that writes to XML, right?  We are attempting to pinpoint the problem:  this plugin, another plugin, or the way your content is being converted.  It's a quick and dirty test to check that you can output to XML at all.
Avatar of Howard Bash
Howard Bash
Flag of United States of America image

ASKER

Can you suggest an alternate xml plugin?
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Howard Bash
Howard Bash
Flag of United States of America image

ASKER

So far the problem persists and the suggested google-xml-sitemaps plugin is showing the error upon attempting to run it (not always).
What does "not always" mean?
Avatar of Howard Bash
Howard Bash
Flag of United States of America image

ASKER

The google xml plugin code runs the rebuild function in a couple of ways.  It runs after you add a post.  It runs when you explicited ask it to via clicking the rebuild link on it's setup page.  And then there is another way that kicks it off which I am not sure of.  I do not see the error for the two methods only for this other method.  I am not sure if it is some periodic run of the rebuild or a run of the rebuild due to a comment being added.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo