Browse: Home / Snippets /

Set custom button text in Course Grid

Contents


Snippet #

Important: All snippets are provided as-is without support or guarantees. These snippets are provided as guidelines for advanced users looking to customize LearnDash. For any additional help or support with these snippets, we recommend reaching out to a LearnDash Expert.

add_filter( 'learndash_course_grid_custom_button_text', function( $button_text = '', $post_id = 0 ) {
	// Example 1
	// Change button label to something custom
	$button_text = "Custom Button Label";
	
	// Example 2
	// Change button label to something custom for specific $post_id
	if ( in_array( $post_id, array( 2424, 12, 34, 56, 78) ) ) {
		$button_text = "Alt Custom Button Label";
	}
	
	// Always return $button_text
	return $button_text;
}, 10, 2 );