WordPress.org

Plugin Directory

Linkify Text

Automatically hyperlink words or phrases in your posts.

Filters

The plugin exposes five filters for hooking. Typically, the code to utilize these hooks would go inside your active theme's functions.php file. Bear in mind that all of the features controlled by these filters are configurable via the plugin's settings page. These filters are likely only of interest to advanced users able to code.

c2c_linkify_text_filters (filter)

The 'c2c_linkify_text_filters' hook allows you to customize what hooks get text linkification applied to them.

Arguments:

  • $hooks (array): Array of hooks that will be text linkified.

Example:

// Enable text linkification for custom fields
add_filter( 'c2c_linkify_text_filters', 'more_text_replacements' );
function more_text_replacements( $filters ) {
    $filters[] = 'the_meta'; // Here you could put in the name of any filter you want
    return $filters;
}

c2c_linkify_text_comments (filter)

The 'c2c_linkify_text_comments' hook allows you to customize or override the setting indicating if text linkification should be enabled in comments.

Arguments:

  • $state (bool): Either true or false indicating if text linkification is enabled for comments. The default value will be the value set via the plugin's settings page.

Example:

// Prevent text linkification from ever being enabled in comments.
add_filter( 'c2c_linkify_text_comments', '__return_false' );

c2c_linkify_text (filter)

The 'c2c_linkify_text' hook allows you to customize or override the setting defining all of the text phrases and their associated links.

Arguments:

  • $linkify_text_array (array): Array of text and their associated links. The default value will be the value set via the plugin's settings page.

Example:

// Add more text to be linked
add_filter( 'c2c_linkify_text', 'my_text_linkifications' );
function my_text_linkifications( $replacements ) {
    // Add text link
    $replacements['Matt Mullenweg'] => 'http://ma.tt';
    // Unset a text link that we never want defined
    if ( isset( $replacements['WordPress'] ) )
        unset( $replacements['WordPress'] );
    // Important!
    return $replacements;
}

c2c_linkify_text_case_sensitive (filter)

The 'c2c_linkify_text_case_sensitive' hook allows you to customize or override the setting indicating if text matching for potential text linkification should be case sensitive or not.

Arguments:

  • $state (bool): Either true or false indicating if text matching is case sensitive. The default value will be the value set via the plugin's settings page.

Example:

// Prevent text matching from ever being case sensitive.
add_filter( 'c2c_linkify_text_case_sensitive', '__return_false' );

c2c_linkify_text_replace_once (filter)

The 'c2c_linkify_text_replace_once' hook allows you to customize or override the setting indicating if text linkification should be limited to once per term per piece of text being processed regardless of how many times the term appears.

Arguments:

  • $state (bool): Either true or false indicating if text linkification is to only occur once per term. The default value will be the value set via the plugin's settings page.

Example:

// Only linkify a term once per post.
add_filter( 'c2c_linkify_text_replace_once', '__return_true' );

Requires: 3.6 or higher
Compatible up to: 4.1.6
Last Updated: 2015-2-21
Active Installs: 1,000+

Ratings

3.2 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1
0,1,0
100,1,1