I installed a new Wordpress theme today and when I try to post anything I get the following error;
“Notice: Undefined index: action in /home/content/00/00000000/html/sites/website.com/wp-content/themes/bedford/inc/bedford-metaboxes.php on line 601
Warning: Cannot modify header information – headers already sent by (output started at /home/content/00/00000000/html/sites/website.com/wp-content/themes/bedford/inc/bedford-metaboxes.php:601) in /home/content/00/00000000/html/sites/website.com/wp-includes/pluggable.php on line 1228”
The code from around 601 is:
add_action( 'admin_init', 'bedford_cmb1_to_cmb2_post_meta' );
function bedford_cmb1_to_cmb2_post_meta(){
global $pagenow;
// If screen is not single post edit do nothing.
if ( 'post.php' === $pagenow && 'edit' === $_GET['action'] && is_numeric($_GET['post'])) {
$_rpit_meta_fields_repeat_group = get_post_meta( $_GET['post'], '_rpit_meta_fields_repeat_group', true);
// Remove empty _rpit_meta_fields_repeat_group post meta if exist.
if( is_array($_rpit_meta_fields_repeat_group) && empty($_rpit_meta_fields_repeat_group) ) {
print_r('empty array found');
delete_post_meta($_GET['post'], '_rpit_meta_fields_repeat_group');
}
}
}
If anyone could help it would be greatly appreciated.