I’m currently having a little trouble with removing the Archive Headline and Archive Intro Text fields on the category and tag archive screen in WP Admin.
On the category and tag archive pages, there is the standard title and description fields which is what the client will use in place of the archive headline and intro text. In order to eliminate confusion, I would like to remove the Archive Headline and Archive Intro Text fields from WP Admin.
In the Genesis framework core files, I found this bit hanging around in cpt-archive-settings.php
:
public function archive_box() {
?>
<p><?php printf( __( 'View the <a href="https://wordpress.stackexchange.com/questions/239825/%s">%s archive</a>.', 'genesis' ), get_post_type_archive_link( $this->post_type->name ), $this->post_type->name ); ?></p>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row"><label for="<?php $this->field_id( 'headline' ); ?>"><b><?php _e( 'Archive Headline', 'genesis' ); ?></b></label></th>
<td>
<p><input class="large-text" type="text" name="<?php $this->field_name( 'headline' ); ?>" id="<?php $this->field_id( 'headline' ); ?>" value="<?php echo esc_attr( $this->get_field_value( 'headline' ) ); ?>" /></p>
<p class="description"><?php _e( 'Leave empty if you do not want to display a headline.', 'genesis' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="<?php $this->field_id( 'intro_text' ); ?>"><b><?php _e( 'Archive Intro Text', 'genesis' ); ?></b></label></th>
<td>
<?php wp_editor( $this->get_field_value( 'intro_text' ), $this->settings_field . "-intro-text", array( 'textarea_name' => $this->get_field_name( 'intro_text' ) ) ); ?>
<p class="description"><?php _e( 'Leave empty if you do not want to display any intro text.', 'genesis' ); ?></p>
</td>
</tr>
</tbody>
</table>
<?php
}
I’ve tried the following code in my functions.php
file to try to remove the Archive Headline and Archive Intro Text fields. I haven’t come up with a solution on how to remove it on category and tag archive edit screens yet, but figured I would begin with the basic function first.
Here is what I got after consulting the WordPress Codex for remove_action as well as remove_meta_box:
add_action( 'admin_menu', 'remove_archive_intro_headline' );
function remove_archive_intro_headline(){
remove_meta_box( 'archive_box', 'admin_menu', 'normal' );
}
Unfortunately, it did not work. Is there another method that will allow me to remove the Archive Headline and Archive Intro Text fields from WP admin on category and tag archive edit screens? Any help would be much appreciated! Thank you!