Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Frank

trim string

can I trim the length of the output in the list view. I have some api keys in custom fields and I don’t want to see the whole thing, I do want to know that it is there though and inline edit.

Awesome plugin by the way.

Thanks
Frank

10 years ago
Tobias Schutter
Developer

Hi Frank,

Try this:


/**
 * Mask customfield output
 *
 */
function myplugin_column_meta_value_trim_key( $value, $object_id, $column ) {

    // Fill in your custom field key!
    $custom_field_key = 'my_custom_field_key';

    if ( 'column-meta' == $column->properties->type && $custom_field_key == $column->options->field ) {
        $value = str_repeat ( '*', 6 ) . substr( $value, -4 );
    }
    return $value;
}
add_filter( 'cac/column/meta/value', 'myplugin_column_meta_value_trim_key', 10, 3 );

edit: updated script

10 years ago
Frank

Thanks a lot, works good.

9 years, 12 months ago

You must be logged in to reply to this topic.