[resolved] Warning error after use of an array (7 posts)

  1. m_bird
    Posted 5 years ago #

    I recently added an array to a section of php coding in order to apply it in multiple circumstances. The code itself is accurate but when I add it to my code I get the following message:

    Warning: Illegal offset type in isset or empty in /home/adminbhd/public_html/wp-admin/includes/template.php on line 877

    This warning continues on several lines within this file. Can anyone tell me why it would affect this file at all and also if any one has a solutions I would greatly appreciate it.

    Many Thanks

  2. s_ha_dum
    Posted 5 years ago #

    It going to be hard to help without seeing the section of code that you edited. Can you post that to the pastebin?

  3. m_bird
    Posted 5 years ago #

    Sure thing, Thanks for looking.

    The original code is: http://pastebin.com/KvkfBq3G

    the modified code is: http://pastebin.com/zZRi5NY8

    I am using the thesis theme.

  4. s_ha_dum
    Posted 5 years ago #

    Two things.

    $meta_box['id'], $meta_box['title'], array('thesis_post_options', 'output_' . $meta_name . '_box'), array( 'graphics', 'illustration', 'logos' ) 'normal', 'high'

    It looks like you can't use an array as that fifth parameter and, second, you are missing a comma between the fifth and sixth parameter.

  5. m_bird
    Posted 5 years ago #

    Apologies, the comma was present in the modified code I tried, it was just posted wrong, the same warning occurs. Do you perhaps know of a way I could achieve the same affect (i.e adding the meta boxes to my custom posts) without the array there? I cannot repeat the code and attribute a new name as I get a repeat error.

  6. s_ha_dum
    Posted 5 years ago #

    You could nest another foreach loop.

  7. Digital Raindrops
    Posted 5 years ago #

    The new meta_boxes array will be null on the existing posts, so you need to test if the array has a value.

    $post_options = new thesis_post_options;
    if( isset( $post_options ) ) {
       // Do Stuff



Topic Closed

This topic has been closed to new replies.

About this Topic