Example #1
0
 /**
  * Utility method that resets permalinks and flushes rewrites.
  *
  * @since 2.6.0 bbPress (r5947)
  *
  * @global WP_Rewrite $wp_rewrite
  *
  * @uses WP_UnitTestCase::set_permalink_structure()
  *
  * @param string $structure Optional. Permalink structure to set. Default empty.
  */
 public function set_permalink_structure($structure = '')
 {
     // Use WP 4.4+'s version if it exists.
     if (method_exists('parent', 'set_permalink_structure')) {
         parent::set_permalink_structure($structure);
     } else {
         global $wp_rewrite;
         $wp_rewrite->init();
         $wp_rewrite->set_permalink_structure($structure);
         $wp_rewrite->flush_rules();
     }
 }
Example #2
0
 /**
  * Utility method that resets permalinks and flushes rewrites.
  *
  * Also updates the pre_option filter for `permalink_structure`.
  *
  * @global WP_Rewrite $wp_rewrite
  *
  * @param string $structure Optional. Permalink structure to set. Default empty.
  */
 public function set_permalink_structure($structure = '')
 {
     global $wp_tests_options;
     $wp_tests_options['permalink_structure'] = $structure;
     parent::set_permalink_structure($structure);
 }