Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm developing with Wordpress in a multi environment scenario. I develop on my local machine, test on a server and so on.

I was using the "trick" of having a local-config.php file to have different configurations based on the environment. Today I discovered this: Wordpress config bootstrap.

It's just a simple improvement of the default wp-config.php file. It's working fine, but on my local environment appeared this error:

Notice: Undefined property: stdClass::$id in /home/carlo/public_html/altrababele/wp-content/themes/wp-foundation/index.php on line 21

The code generating the error is this:

<?php echo get_the_post_thumbnail( $post->id); ?><div class="date"><time datetime="<?php echo the_time('y-m-j'); ?>" pubdate><?php the_time('j'); ?><br><?php the_time('M'); ?><br><?php the_time('y'); ?></time></div>

I set the debug option to false, but nothing changes. The problem appears to be that id is lowercase, so writing $post->ID actually solves the issue. It's strange because if I use the local-config.php it works just fine, but all the options are the same.

any suggestions?

share|improve this question

1 Answer 1

The WordPress-Config-Bootstrap is setting DEBUG to true on a local installation. If you try to define DEBUG again later you should get another error. The solution is not to use the non-existent property $id. Notices should be fixed not suppressed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.