Support » Plugin: PowerPress Podcasting plugin by Blubrry » PHP Notices with Custo Post Type feeds

  • Resolved omerida

    (@omerida)


    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)
  • Plugin Support Shawn

    (@shawnogordo)

    I have asked the Blubrry dev team to look at your post. A response will be posted here as soon as they’ve had a chance to look at it.

    Plugin Author Angelo Mandato

    (@amandato)

    Hello @shawnogordo,

    Thank you for reporting this issue. We’ve identified 4 other places in other areas of PowerPRess where this same check should occur and added the same fix. We only made one slight change from your contribution…

    from:

       if (is_array($post_type)) {
          $post_type = $post_type[0];
       }

    to:

       if ( is_array( $post_type ) ) {
          $post_type = reset( $post_type ); // get first element in array
       }

    We found this was the solution WordPress core uses to get the first element within a $post_type array.

    Expect this fix in the next release, which should be pushed out in the coming days.

    Thanks,
    Angelo

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Notices with Custo Post Type feeds’ is closed to new replies.