[wp-trac] [WordPress Trac] #29109: Problem found with wp-includes/posts.php

WordPress Trac noreply at wordpress.org
Mon Aug 4 14:37:56 UTC 2014


#29109: Problem found with wp-includes/posts.php
--------------------------+-----------------------------
 Reporter:  LewisCowles   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:  3.9.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Warning Raised
 Invalid argument for foreach line 1350 of wp-includes/post.php

 using
 ubuntu14.04
 Apache 2.4.6
 MySQL 5.5
 PHP Version 5.5.9-1ubuntu4.3 FPM

 Writing a new theme, noticed this from go with only a functions.php
 (bare), index.php, header.php, footer.php and style.css (all pretty much
 empty apart from theme declaration get_header and get_footer)

 Fixed by changing

 {{{
     foreach ( $args->taxonomies as $taxonomy ) {
       register_taxonomy_for_object_type( $taxonomy, $post_type );
     }
 }}}
 To
 {{{
     if(is_array($args->taxonomies) || is_object($args->taxonomies) ){
       foreach ( $args->taxonomies as $taxonomy ) {
         register_taxonomy_for_object_type( $taxonomy, $post_type );
       }
     }
 }}}


 header.php
 {{{
 <!DOCTYPE html>
 <!--[if lt IE 7]><html class="no-js ie ie6 lte8 lte7"><![endif]-->
 <!--[if IE 7]><html class="no-js ie ie7 lte8 lte7"><![endif]-->
 <!--[if IE 8]><html class="no-js ie ie8 lte8"><![endif]-->
 <!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->
 <head>
     <meta charset="<?php bloginfo( 'charset' ); ?>"/>
     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <title><?php wp_title( '|', true, 'right' ); ?> <?php bloginfo(
 'blog_name' ); ?></title>

     <link rel="profile" href="http://gmpg.org/xfn/11"/>
     <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"/>
     <?php wp_head(); ?>
     <script type="text/javascript">
         (function(H){H.className=H.className.replace(/\bno-
 js\b/,'js')})(document.documentElement)
     </script>
 </head>
 <body <?php body_class(); ?> >

 }}}

 footer.php
 {{{
 <div class="push"></div>
     </div><!-- end of content before footer -->

     <footer class="footer txtC">
         <br/>
         <a href="#" target="_blank" class="pull-right">
             <img src="/assets/brand.png" />
         </a>
     </footer>
     <script type='text/javascript'>
     //<![CDATA[

     //]]>
     </script>
 </body>
 </html>
 }}}

 index.php
 {{{
 <?php get_header(); ?>
   <div class="wrapper"><!-- straight after header -->
     <?php if ( have_posts() ) : ?>
       <?php while ( have_posts() ) : the_post(); ?>
         <?php
             the_content();
             wp_link_pages( array(
                 'before'      => '<div class="page-links"><span class
 ="page-links-title">' . 'Pages: ' . '</span>',
                 'after'       => '</div>',
                 'link_before' => '<span>',
                 'link_after'  => '</span>',
             ) );
             edit_post_link( 'Edit', '<span class="edit-link">', '</span>'
 );
         ?>
       <?php endwhile; ?>
     <?php endif; ?>
 <?php wp_footer(); ?>
 <?php get_footer(); ?>
 }}}

 functions.php is empty

 style.css is empty

 This is not my first Wordpress Theme, never encountered this before, I
 have fixed... Wish you had a github advertised on wordpress.org but if you
 do I cant find it...

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29109>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list