PHP Notices with Custo Post Type feeds
-
I noticed my custom post feed (I only have one configured) was generating a PHP Notice and as a result not including any podcast info (itunes metadata, enclosures) in the RSS feed. This was the error message:
PHP Notice: Array to string conversion in /wp-content/plugins/powerpress/powerpress.php on line 1819
The offending line (1819) is returning an array but powerpress is assuming it’s always a string. 1819 is the last one in the snippet below.
if( !empty($GeneralSettings['posttype_podcasting']) ) { $post_type = get_query_var('post_type'); //$post_type = get_post_type(); if( !empty($post_type) ) { // Get the settings for this podcast post type $PostTypeSettingsArray = get_option('powerpress_posttype_'. $post_type);
In my case, I only have one post type in my feed so adding a check and grabbing the first item in the array solved it.
$post_type = get_query_var('post_type'); //$post_type = get_post_type(); if( !empty($post_type) ) { if (is_array($post_type)) { $post_type = $post_type[0]; } // Get the settings for this podcast post type
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘PHP Notices with Custo Post Type feeds’ is closed to new replies.