[wp-trac] Re: [WordPress Trac] #7589: Fatal error: Call to a member function get_page_permastruct() on a non-object in /home/omry/dev/php/wp/2.6/wp-includes/link-template.php on line 152

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 4 21:38:37 GMT 2008


#7589: Fatal error: Call to a member function get_page_permastruct() on a non-
object in /home/omry/dev/php/wp/2.6/wp-includes/link-template.php on line
152
-------------------------------+--------------------------------------------
 Reporter:  omry               |        Owner:  anonymous
     Type:  defect             |       Status:  new      
 Priority:  normal             |    Milestone:  2.7      
Component:  General            |      Version:  2.6      
 Severity:  normal             |   Resolution:           
 Keywords:  reporter-feedback  |  
-------------------------------+--------------------------------------------
Comment (by omry):

 here is a pretty minimal test case that demonstrates the problem.
 it's nothing as fancy as you asked, but it's easy enough to use.

 in it's present form, the plugin will activate successfully. if you will
 comment the 'works' line and uncomment the 'fails' line the plugin will
 fail to activate.

 {{{
 <?php
 /*
 Plugin Name: Page permabug plugin
 Plugin URI: bogus.org
 Description: The bogus plugin from hell
 Author: Ya
 Version: 666.6
 Author URI: nope.org
 */

 fs_update_post_titles("post");  // works
 #fs_update_post_titles("page"); // fails


 function fs_update_post_titles($type)
 {
     global $wpdb;
     $posts = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts
 WHERE post_type = '$type'");

     foreach($posts as $post)
     {
         $id = $post->ID;
         $title = $post->post_title;
         $link = get_permalink($id);
     }
 }
 ?>

 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7589#comment:12>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list