public function test__unregister_post_status() { register_post_status('foo'); _unregister_post_status('foo'); $stati = get_post_stati(); $this->assertFalse(isset($stati['foo'])); }
public static function wpSetUpBeforeClass($factory) { self::$editor_user_id = $factory->user->create(array('role' => 'editor')); self::$author_user_id = $factory->user->create(array('role' => 'author')); self::$editor_private_post = $factory->post->create(array('post_author' => self::$editor_user_id, 'post_status' => 'private')); self::$author_private_post = $factory->post->create(array('post_author' => self::$author_user_id, 'post_status' => 'private')); // Custom status with private=true. register_post_status('privatefoo', array('private' => true)); self::$editor_privatefoo_post = $factory->post->create(array('post_author' => self::$editor_user_id, 'post_status' => 'privatefoo')); self::$author_privatefoo_post = $factory->post->create(array('post_author' => self::$author_user_id, 'post_status' => 'privatefoo')); _unregister_post_status('privatefoo'); }
public static function setUpBeforeClass() { $f = new WP_UnitTest_Factory(); self::$editor_user = $f->user->create(array('role' => 'editor')); self::$author_user = $f->user->create(array('role' => 'author')); self::$editor_private_post = $f->post->create(array('post_author' => self::$editor_user, 'post_status' => 'private')); self::$author_private_post = $f->post->create(array('post_author' => self::$author_user, 'post_status' => 'private')); // Custom status with private=true. register_post_status('privatefoo', array('private' => true)); self::$editor_privatefoo_post = $f->post->create(array('post_author' => self::$editor_user, 'post_status' => 'privatefoo')); self::$author_privatefoo_post = $f->post->create(array('post_author' => self::$author_user, 'post_status' => 'privatefoo')); _unregister_post_status('privatefoo'); self::commit_transaction(); }
/** * Unregister non-built-in post statuses. */ protected function reset_post_statuses() { foreach (get_post_stati(array('_builtin' => false)) as $post_status) { _unregister_post_status($post_status); } }