| 398 | | $id = str_replace( '.php', '', $id ); |
| 399 | | if ( in_array( substr( $id, -4 ), array( '-add', '-new' ) ) ) |
| 400 | | $action = 'add'; |
| 401 | | $id = str_replace( array( '-new', '-add' ), '', $id ); |
| | 398 | // For those pesky meta boxes. |
| | 399 | if ( $hook_name && post_type_exists( $hook_name ) ) { |
| | 400 | $post_type = $id; |
| | 401 | $id = 'post'; // changes later. ends up being $base. |
| | 402 | } else { |
| | 403 | $last_four = substr( $id, -4 ); |
| | 404 | if ( '.php' == $last_four ) { |
| | 405 | $id = substr( $id, 0, -4 ); |
| | 406 | $last_four = substr( $id, -4 ); |
| | 407 | } |
| | 408 | if ( '-add' == $last_four || '-new' == $last_four ) { |
| | 409 | $id = substr( $id, 0, -4 ); |
| | 410 | $action = 'add'; |
| | 411 | } |
| | 412 | } |
| 413 | | if ( post_type_exists( $id ) ) { |
| 414 | | $post_type = $id; |
| 415 | | $id = 'post'; // changes later. ends up being $base. |
| 416 | | } elseif ( false !== strpos( $id, '-' ) ) { |
| 417 | | list( $first, $second ) = explode( '-', $id, 2 ); |
| 418 | | if ( taxonomy_exists( $second ) ) { |
| | 424 | if ( 'edit-' == substr( $id, 0, 5 ) ) { |
| | 425 | $maybe = substr( $id, 5 ); |
| | 426 | if ( taxonomy_exists( $maybe ) ) { |