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:

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?

  • Nastia
    • Support Rock Star

    Hello Rob

    Hope you're doing well!

    We've flagged our second level developers so they could have a closer look at the issue. Please note, our developers' response time is longer-than-normal compared to support staff response times.

    Have a good day and take care!

    Kind regards,

  • Panos
    • SLS

    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.