Filter uncanny-continuing-education-credits

document_title_separator

This filter is documented in https://developer.wordpress.org/reference/hooks/document_title_separator/ */ Filters the separator used between post title and site name in the document title.

add_filter( 'document_title_separator', $callback, 10, 1 );

Description

Filters the separator used between page titles and site names in the document title. Developers can override the default hyphen to customize title structure for SEO or branding. This filter fires during the generation of the document title.


Usage

add_filter( 'document_title_separator', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

/**
 * Change the document title separator to a more visually distinct character for certificates.
 *
 * This function modifies the default document title separator used by WordPress
 * when generating certificate titles to ensure better readability and distinction
 * from regular page titles.
 *
 * @param string $separator The current document title separator.
 * @return string The modified document title separator.
 */
function custom_certificate_document_title_separator( $separator ) {
    // You might want to check if this is actually a certificate context if possible,
    // but for this example, we'll assume any use of this filter in this specific
    // theme or plugin implies a certificate.
    return ' :: ';
}
add_filter( 'document_title_separator', 'custom_certificate_document_title_separator', 10, 1 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/includes/tcpdf-certificate-code.php:281

ob_start();

		$cert_args['cert_title'] = $cert_args['cert_post']->post_title;
		$cert_args['cert_title'] = strip_tags( $cert_args['cert_title'] );

		/** This filter is documented in https://developer.wordpress.org/reference/hooks/document_title_separator/ */
		$sep = apply_filters( 'document_title_separator', '-' );

		/**
		 * Filters username of the user to be used in creating certificate PDF.
		 *
		 * @param string $user_name User display name.
		 * @param int $user_id User ID.
		 * @param int $cert_id Certificate post ID.


Scroll to Top