How To Change The Label Of A Core Custom Field

Awesome Support implements a lot of its data using its own custom fields functionality.  As such you can use many of the built in custom fields functions, actions and filters to control how these fields behave.  Examples of fields that are implemented this way include Product and Department.

Additionally, in version 3.6 and later, fields such as Priority, Channel and a few other core fields were introduced.  Along with these new fields, there is a filter that can now be used to change the labels attached to these fields.  Here is an example function that uses this filter:

add_filter( 'wpas_cf_field_label', 'wpas_cf_change_label', 10, 2 );
function wpas_cf_change_label( $label, $field ) {

    switch ( $field[ 'name' ] ) {

        // Ticket Priority label
        case 'ticket_priority':

            return 'A New Ticket Priority Label';
            break;

        // Ticket Channel label
        case 'ticket_channel':

            return 'A New Ticket Channel Label';
            break;

        // Department Label
        case 'department':

            return 'A New Department Label';
            break;

        // Product Label
        case 'product':

            return 'A New Product Label';
            break;

        default:

            return $label = 'NEW TOO: ' . $label;

            break;

    }

}

Column Headers In The Ticket List

The above filter only applies to custom fields defined internally by Awesome Support.  These fields will have the labels changed in the header of the ticket list.  BUT, the ticket list has other fields that are not internal custom fields.  For these, you would have to use a different filter:

add_filter('wpas_custom_column_title', 'wpas_custom_column_title', 10, 2);
function wpas_custom_column_title( $field_title, $field ) {

if( empty( $field ) ) {
 return 'Error';
}

switch ( $field['name'] ) {
 
 case 'product':

 return 'PROD ' . $field_title;
 break; 

 case 'department':

 return 'DEPT ' . $field_title;
 break;

 case 'ticket_channel':

 return 'CHAN ' . $field_title;
 break;
 
 case 'ticket_priority':

 return 'PRIO ' . $field_title;
 break; 

 case 'ticket-tag':

 return 'TAG ' . $field_title;
 break;

 case 'wpas-activity':

 return 'ACTV ' . $field_title;
 break;

 default:

 return $field_title;

}
}

Finally, there are even other columns that have to be handled differently.  Here is an example of those:

add_action( 'manage_ticket_posts_columns', 'wpas_column_title', 20, 1 );
function wpas_column_title( $posts_columns ) {

$posts_columns[ 'date' ] = 'Last Modified';

$posts_columns[ 'id' ] = 'Ticket #';

$posts_columns[ 'title' ] = 'new title';

return $posts_columns;

}

Requires

All of these filters require Awesome Support 3.6.0 or later in order to work!

Don’t want to write your own code?  Then get our Powerpack/Productivity extension which provides a nice, friendly user interface for these features!
Smart Chat
Smart Replies add-on Chat X