Changing the labels of the approval statuses

Approval status table showing entries marked Disapproved and Unapproved

Depending on the project, there are labels more suited than the existing ones: Approval, Unapproved, and Disapproved. Fortunately, there's an easy way to change them.

Once the Approval Status field is added to your View, click on the cog icon to access the Approval Status Settings modal:

Gear icon next to "Approval Status" with tooltip "Configure Approval Status Settings"

On the Approval Status Settings modal, you can change the labels for the three available statuses:

Approval Status Settings with fields for Approved, Disapproved, and Unapproved labels

Changing the labels of the actions of the Approve Entries field

It is also possible to change the labels of the actions from the Approve Entries field.

Toolbar for changing approval status icons in a table, including approve, reject, and pending status options

In the example below, replace the ###### characters with the new label you prefer for each action.

add_filter( 'gettext', 'gk_modify_approval_text', 20, 3 );
function gk_modify_approval_text( $translated_text, $text, $domain ) {

	if ( $domain !== 'gk-gravityview') {
		return $translated_text;
	}
    
	if ( ! class_exists( '\GravityView_View' ) ) {
		return $translated_text;
	}
	
	$view_id = GravityView_View::getInstance()->getViewId();
        if($view_id !== 66){ // Change 66 to your View ID
		return $translated_text;
	}

	if ( $translated_text === 'Disapproved' ) {
		$translated_text = '#######';
	}
	
	if ( $translated_text === 'Disapprove' ) {
		$translated_text = '#######';
	}
	if ( $translated_text === 'Approved' ) {
		$translated_text = '#######';
	}

	if ( $translated_text === 'Approve' ) {
		$translated_text = '#######';
	}

	if ( $translated_text === 'Unapproved' ) {
		$translated_text = '#######';
	}

	if ( $translated_text === 'Reset Approval' ) {
		$translated_text = '#######';
	}
	
	return $translated_text;
}

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us