| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | if(preg_match('|wp-admin/post(-new)?\.php|', $_SERVER['REQUEST_URI'])) { |
|---|
| 4 | ob_start('my_filter_post_page'); |
|---|
| 5 | } |
|---|
| 6 | function my_filter_post_page($content) { |
|---|
| 7 | global $post, $wp_post_types; |
|---|
| 8 | //remove preview button and view post message |
|---|
| 9 | if (!$wp_post_types[$post->post_type]->publicly_queryable) { |
|---|
| 10 | $content = preg_replace("/<div id=\"preview-action\">.*?<\/div>/mis", '', $content); |
|---|
| 11 | $content = preg_replace("/<div id=\"edit-slug-box\">.*?<\/div>/mis", '', $content); |
|---|
| 12 | $content = preg_replace("/<a href=\"[^\"]*\">View post<\/a>/mis", '', $content); |
|---|
| 13 | } |
|---|
| 14 | |
|---|
| 15 | return $content; |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | ?> |
|---|