Example #1
0
/**
 * Initialize parts of GUI depending on current screen.
 *
 * @since 1.9
 */
function wpcf_initialize_admin_gui()
{
    $screen = get_current_screen();
    // Should be always true.
    if ($screen instanceof WP_Screen) {
        if (in_array($screen->base, array('edit-tags', 'term'))) {
            WPCF_GUI_Term_Field_Editing::initialize();
        }
    }
}
Example #2
0
 /**
  * On the Add Term page, we need to initialize the page controller WPCF_GUI_Term_Field_Editing
  * so that it saves term fields (if there are any).
  *
  * @since 2.1
  */
 public function prepare_for_term_creation()
 {
     // Takes care of the rest, mainly we're interested about the create_{$taxonomy} action which follows
     // immediately after create_term.
     //
     // On actions fired on the Add Term page, the action POST variable is allways add-tag and the screen is set
     // to edit-{$taxonomy}. When creating the term on the post edit page, for example, the screen is not set. We use
     // this to further limit the resource wasting. However, initializing the controller even if it's not supposed to
     // will not lead to any errors - it gives up gracefully.
     $action = wpcf_getpost('action');
     $screen = wpcf_getpost('screen', null);
     if ('add-tag' == $action && null !== $screen) {
         WPCF_GUI_Term_Field_Editing::initialize();
     }
 }