Automatic Sample Page Delete
-
I just went through hell after updating to 4.1
I’ve worked out all my kinks except for 1for the past year I have been using this piece of code in my theme’s functions.php (minus the backtics ` obviously) to automatically delete my sample page every time I make a new site:
5
// Find and delete the WP default 'Sample Page'
6$defaultPage = get_page_by_title( 'Sample Page' );
7wp_delete_post( $defaultPage->ID );However, all of a sudden, I am getting this error:
Notice: Trying to get property of non-object in ../wp-content/themes/Nuvellen/functions.php on line 7I just did a test by making a new site, and it does delete the sample page, but I can’t figure out why it would give me this error all of a sudden
Thanks
The topic ‘Automatic Sample Page Delete’ is closed to new replies.