Changeset 38750
- Timestamp:
- 10/07/2016 07:38:03 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-tags.php
r38735 r38750 62 62 $location = false; 63 63 $referer = wp_get_referer(); 64 if ( ! $referer ) { // For POST requests. 65 $referer = wp_unslash( $_SERVER['REQUEST_URI'] ); 66 } 67 $referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message' ), $referer ); 64 68 65 69 switch ( $wp_list_table->current_action() ) { 66 70 67 71 case 'add-tag': 68 69 72 check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); 70 73 … … 78 81 79 82 $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); 80 $location = 'edit-tags.php?taxonomy=' . $taxonomy;81 if ( 'post' != $post_type )82 $location .= '&post_type=' . $post_type;83 84 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) {85 $location = $referer;86 }87 88 83 if ( $ret && !is_wp_error( $ret ) ) 89 84 $location = add_query_arg( 'message', 1, $location ); 90 85 else 91 $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $ location);86 $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $referer ); 92 87 93 88 break; 94 89 95 90 case 'delete': 96 $location = 'edit-tags.php?taxonomy=' . $taxonomy;97 if ( 'post' != $post_type )98 $location .= '&post_type=' . $post_type;99 100 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) {101 $location = $referer;102 }103 104 91 if ( ! isset( $_REQUEST['tag_ID'] ) ) { 105 92 break; … … 119 106 wp_delete_term( $tag_ID, $taxonomy ); 120 107 121 $location = add_query_arg( 'message', 2, $ location);108 $location = add_query_arg( 'message', 2, $referer ); 122 109 123 110 break; … … 139 126 } 140 127 141 $location = 'edit-tags.php?taxonomy=' . $taxonomy; 142 if ( 'post' != $post_type ) 143 $location .= '&post_type=' . $post_type; 144 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 145 $location = $referer; 146 } 147 148 $location = add_query_arg( 'message', 6, $location ); 128 $location = add_query_arg( 'message', 6, $referer ); 149 129 150 130 break; … … 183 163 $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); 184 164 185 $location = 'edit-tags.php?taxonomy=' . $taxonomy; 186 if ( 'post' != $post_type ) 187 $location .= '&post_type=' . $post_type; 188 189 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 190 $location = $referer; 191 } 192 193 if ( $ret && !is_wp_error( $ret ) ) 194 $location = add_query_arg( 'message', 3, $location ); 195 else 196 $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); 165 if ( $ret && ! is_wp_error( $ret ) ) { 166 $location = add_query_arg( 'message', 3, $referer ); 167 } else { 168 $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $referer ); 169 } 197 170 break; 198 171 default: … … 219 192 220 193 if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { 221 $location = remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) );194 $location = remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ); 222 195 } 223 196 224 197 if ( $location ) { 225 if ( ! empty( $_REQUEST['paged'] ) ) { 226 $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); 227 } 198 $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages. 228 199 229 200 /**
Note: See TracChangeset
for help on using the changeset viewer.