Auto Link Keywords in Post Content And Excerpt

// auto link keywords in post content and excerpt
function wcs_auto_link_keywords( $text ) {
    $replace = array(
        'wordpress' => '<a href="">wordpress</a>',
        'google' => '<a href="">excerpt</a>',
        'facebook' => '<a href="">function</a>'
    $text = str_replace( array_keys($replace), $replace, $text );
    return $text;
add_filter( 'the_content', 'wcs_auto_link_keywords' );
add_filter( 'the_excerpt', 'wcs_auto_link_keywords' );
The following two tabs change content below.

Md Jahed

Latest posts by Md Jahed (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *