apply_filters( ‘privacy_on_link_title’, string $title )

Filters the link title attribute for the ‘Search engines discouraged’ message displayed in the ‘At a Glance’ dashboard widget.

Description

Prior to 3.8.0, the widget was named ‘Right Now’.

Parameters

$titlestring
Default attribute text.

Source

$title = apply_filters( 'privacy_on_link_title', '' );

Changelog

VersionDescription
4.5.0The default for $title was updated to an empty string.
3.0.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    We will create a function that modifies link titles containing the word “Privacy” by prefixing them with “Modified: “. We will use WordPress filters to achieve this.

    Step 1: Define the Function

    function wpdocs_modify_privacy_on_link_title_defaults( $title ) {
        // Check if the title contains the word 'Privacy'
        if ( strpos( $title, 'Privacy' ) !== false ) {
            // Modify the title
            $title = 'Modified: ' . $title;
        }
    
        return $title;
    }
    
    // Add the filter
    add_filter( 'privacy_on_link_title', 'wpdocs_modify_privacy_on_link_title_defaults' );

    Step 2: Apply the Filter for Demonstration

    // For demonstration, we'll use the filter on a sample link title
    $sample_title = __( 'Privacy Policy' );
    $modified_title = apply_filters( 'wpdocs_privacy_on_link_title', $sample_title );
    
    // Output the result for demonstration purposes
    echo $modified_title;  // This should output "Modified: Privacy Policy"

    Step 3: Remove the Filter (Optional)

    // Remove the filter if you no longer need it
    remove_filter( 'privacy_on_link_title", 'wpdocs_modify_privacy_on_link_title_defaults' );

You must log in before being able to contribute a note or feedback.