Link

WordPress shows very limited data about a plugin like an author, plugin URI, version etc. on the plugins page. But there may be occasions where you would like to show some more links here. Those links may be a donation link, may be a link to the PRO version (if you have one), may be support forum, may be some other as well. So if this is what the requirement is, then how can we achieve this one?

Well, there is a hook available which we can use to pass or create more options here. The hook is plugin_row_meta. Let’s see one example on implementing this assuming my plugin is WTI Like Post (wti-like-post).

/**
 * Additional links on plugins page
 *
 * @param array
 * @param string
 *
 * @return array
 */
function wti_custom_plugin_row_meta( $links, $file ) {

	if ( strpos( $file, 'wti-like-post.php' ) !== false ) {
		$new_links = array(
					'<a href="donation_url" target="_blank">' . __( 'Donate', 'wti-like-post' ) . '</a>',
					'<a href="pro_version_url" target="_blank">' . __( 'PRO Version', 'wti-like-post' ) . '</a>',
					'<a href="support_forum_url" target="_blank">' . __( 'PRO Support Forum', 'wti-like-post' ) . '</a>',
				);

		$links = array_merge( $links, $new_links );
	}

	return $links;
}

add_filter( 'plugin_row_meta', 'wti_custom_plugin_row_meta', 10, 2 );

You need to replace the URLs accordingly. I am checking if the current plugin is my plugin or not. If yes, I am creating an array having new links. Then I merge the original links wit the new ones and return the complete set of links.

That’s it. Now you should see 3 more links just below your plugin details on plugins listing page. Happy Coding 🙂

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.