Can't delete custom field error

I've tried inserting a small code for custompress and it seems I broke CustomPress: This is the code I tried:

https://premium.wpmudev.org/forums/topic/custompress-adding-multiple-choice-custom-fields-options-in-bulk#post-798696

Now I am getting this error on the field and I can't delete it:

one parameter 2 to be array, null given in /wp-content/plugins/custompress/core/content-types.php on line 317

I'm using serverpilot, can access it through terminal nothing else, so, there is any PHP/SQL code that I can add to functions.php to delete this field from the database?

http://take.ms/SR07T

  • Panos

    Hi there Rob ,

    I can't access the site, but from the screenshot it seems that there is no post type assigned to the custom field.

    You can set the post types with a snippet. You need to know the post types this field will be used by and the id of the field. You can then add post types as follows:

    //The id of the checkbox fields is "checkbox_5b01128e6c7dc"
    //We add post and page post types
    
    $cf = get_option( 'ct_custom_fields' );
    
    $cb_field = $cf[ 'checkbox_5b01128e6c7dc' ];
    $cb_field['object_type'] = array( 'page', 'post' );
    $cf[ 'checkbox_5b01128e6c7dc' ] = $cb_field;
    
    update_option( 'ct_custom_fields', $cf );

    Hope this helps :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.