I think this is related to a theme and not this plugin, but I wanted to share it here. I discovered that using the latest Pro v1.3 in conjunction with a StudioPress Genesis v1.9.2 child theme, if I put a custom field into a venue I get this error displayed above the venue (in the back end):
Warning: stripslashes() expects parameter 1 to be string, array given in /path-to-my-site/html/wp-content/themes/genesis/lib/functions/options.php on line 286
I disabled the Genesis theme and used the WP Twenty Eleven theme and the error does not appear.
Support is so good here I thought I’d wait to hear the author’s assessment before I proceed with Genesis theme support. 😉
Jason Smith
I’m afraid I don’t have a Genesis theme with which to test this but using stripslashes_deep()
instead of stripslashes()
should prevent the error. That said (after finding an outdated copy of that page on Google), I’m not sure why this error is occuring:
If I’m not wrong, the error is in:
/** Sanitize term meta */
foreach ( $term->meta as $field => $value )
$term->meta[$field] = apply_filters(
'genesis_term_meta_' . $field,
stripslashes( wp_kses_decode_entities( $value ) ),
$term,
$taxonomy
);
specificaly one of the $term->meta[$field]
is an array, not a string – but EO doesn’t touch $term->meta
at all, so its odd that this problem is occuring. (Perhaps its only noticable with EO installed…).
Stephen Harris
I verified that this error also occurs on the 2.0RC of Genesis. I also verified that your suggested fix of adding stripslashes_deep( does in fact work. I submitted the error and your recommended solution to StudioPress. With 2.0 right around the corner I expect this fix will be put in.
I will let you know here if StudioPress has further feedback. Thanks.
Jason Smith
Hi Jason,
I’ve looked into this a bit more. Genesis seems to be saving anything in $_POST['meta']
to the WordPress options table. In fact the option genesis-term-meta
stores all data for all taxonomy terms:
get_option( 'genesis-term-meta' ) = array(
[term_id] => [meta data]
)
(I don’t know how they get around the fact that term IDs can be shared across taxonomies – or perhaps they don’t try). In any case, Genesis is saving anything in $_POST['meta']
to the ‘genesis-term-meta’ option – but clearly, given their use of stripslashes()
(as opposed to stripslashes_deep()
) they don’t expect $_POST['meta']
to be a 2d array.
However, Event Organiser Pro also uses the $_POST['meta']
for venue custom fields (I’ll change this), and it is a 2d array. Subsequently the venue meta data is being saved to the venue meta data table (by EO) and the options table (by Genesis). Consequently Genesis appends a 2d metadata to the term object (but only expects a 1-dimensional array).
I’ll change Pro in the next update to use a different (namespaced) key – this will stop Genesis duplicating the data. However, using stripslashes_deep()
will cure the symptom without any side effects, and so is an ok immediate patch.
The good news is that once you’ve updated Pro, you can ‘clean’ the Gensis data by resaving your venues. That would then make the immediate patch redundant.
Stephen Harris
Excellent information and support, as usual. I have yet to hear back from StudioPress but the patch will suffice for now and I think you’re doing the right thing by updating your plugin to work around Genesis just in case they don’t make changes.
Jason Smith
Thank you Jason!
If anyone else stumbles across this – this bug has been resolved in the 1.3.1 update.
Stephen Harris