admin管理员组文章数量:1323707
Trying to write an OOP plugin, migrating from a script monkey plugin.
I need to create a number of pages of plugin activation, and have the following code:
public function __construct()
{
global $wpdb;
$this->tablename = $wpdb->prefix . 'arch_church_nominations';
$this->activate();
}
public function activate()
{
$this->createTable(); // this works fine
$this->createPages();
}
...
private function createPages()
{
require_once(ABSPATH . "wp-includes/pluggable.php");
$nominationPost = array(
'post_title' => wp_strip_all_tags('Nominations'),
'post_content' => 'Nominations parent',
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'page',
);
// Insert the post into the database
$this->$parentId = wp_insert_post($nominationPost); // <-- this line
}
}
$archChurchNominations = new ArchChurchNominations();
The noted line above if included causes the following error:
Notice: Trying to get property 'feeds' of non-object in /Users/[USERNAME]/Projects/wordpress/wp-includes/post.php on line 4482
However the exact same code snippet works fine, if not in an OOP plugin. What's wrong with my config please?
本文标签: Error on plugin activation and creating new page
版权声明:本文标题:Error on plugin activation and creating new page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742129781a2422106.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论