{"id":2040,"date":"2024-10-23T11:58:47","date_gmt":"2024-10-23T06:13:47","guid":{"rendered":"https:\/\/aaradhanakalakendra.in\/blog\/?p=2040"},"modified":"2024-10-23T12:03:59","modified_gmt":"2024-10-23T06:18:59","slug":"how-to-add-plugin-version-to-plugin-row-meta","status":"publish","type":"post","link":"https:\/\/aaradhanakalakendra.in\/blog\/how-to-add-plugin-version-to-plugin-row-meta\/","title":{"rendered":"How to Add Plugin Version to plugin_row_meta in WordPress"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"2040\" class=\"elementor elementor-2040\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-979a8bb elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"979a8bb\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-58bca6d\" data-id=\"58bca6d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c52ecbc elementor-widget elementor-widget-text-editor\" data-id=\"c52ecbc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Adding the plugin version to the <code>plugin_row_meta<\/code> section in WordPress can be a useful way to display extra information about a plugin directly on the WordPress admin plugins page. This can help developers or site administrators quickly see the plugin version without needing to check the plugin files or visit the plugin settings.<\/p><p>In this guide, we will walk through how to customize the WordPress admin area by adding the plugin version to the <code>plugin_row_meta<\/code>. This is particularly useful when managing multiple plugins on your site or when distributing plugins and wanting to make sure users can easily check the current version.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-958dda3 elementor-widget elementor-widget-heading\" data-id=\"958dda3\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What is plugin_row_meta?\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-78720de elementor-widget elementor-widget-text-editor\" data-id=\"78720de\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><code>plugin_row_meta<\/code> is a WordPress filter that allows developers to modify the meta information shown in the plugins list table on the WordPress dashboard. Normally, this area displays links to the plugin&#8217;s website, documentation, support, and other relevant resources.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b8a7364 elementor-widget elementor-widget-image\" data-id=\"b8a7364\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"1877\" height=\"877\" src=\"https:\/\/aaradhanakalakendra.in\/blog\/wp-content\/uploads\/2024\/10\/plugin.jpg\" class=\"attachment-full size-full wp-image-2043\" alt=\"plugin_row_meta\" srcset=\"https:\/\/aaradhanakalakendra.in\/blog\/wp-content\/uploads\/2024\/10\/plugin.jpg 1877w, https:\/\/aaradhanakalakendra.in\/blog\/wp-content\/uploads\/2024\/10\/plugin-300x140.jpg 300w, https:\/\/aaradhanakalakendra.in\/blog\/wp-content\/uploads\/2024\/10\/plugin-1024x478.jpg 1024w, https:\/\/aaradhanakalakendra.in\/blog\/wp-content\/uploads\/2024\/10\/plugin-768x359.jpg 768w, https:\/\/aaradhanakalakendra.in\/blog\/wp-content\/uploads\/2024\/10\/plugin-1536x718.jpg 1536w\" sizes=\"(max-width: 1877px) 100vw, 1877px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-21579ee elementor-widget elementor-widget-text-editor\" data-id=\"21579ee\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>By using this filter, you can add custom links or additional data, such as the plugin version, to the <code>plugin_row_meta<\/code>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-682b562 elementor-widget elementor-widget-heading\" data-id=\"682b562\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step-by-Step Guide to Add Plugin Version to plugin_row_meta\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f00012d elementor-widget elementor-widget-heading\" data-id=\"f00012d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">1. Hook into plugin_row_meta Filter<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1b98ab9 elementor-widget elementor-widget-text-editor\" data-id=\"1b98ab9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To add the plugin version to the <code>plugin_row_meta<\/code>, we need to hook into the <code>plugin_row_meta<\/code> filter. Add the following code snippet to your plugin file or theme&#8217;s <code>functions.php<\/code>:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-06c6486 elementor-widget elementor-widget-text-editor\" data-id=\"06c6486\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<blockquote><p>add_filter( &#8216;plugin_row_meta&#8217;, &#8216;add_plugin_version_to_row_meta&#8217;, 10, 2 );<\/p><p>function add_plugin_version_to_row_meta( $plugin_meta, $plugin_file ) {<br \/>\/\/ Specify your plugin file<br \/>if ( $plugin_file == &#8216;your-plugin-folder\/your-plugin-file.php&#8217; ) {<br \/>$plugin_data = get_plugin_data( WP_PLUGIN_DIR . &#8216;\/&#8217; . $plugin_file );<br \/>$version = isset( $plugin_data[&#8216;Version&#8217;] ) ? $plugin_data[&#8216;Version&#8217;] : &#8221;;<br \/>if ( $version ) {<br \/>$plugin_meta[] = &#8216;&lt;strong&gt;&#8217; . esc_html__( &#8216;Version: &#8216;, &#8216;text-domain&#8217; ) . $version . &#8216;&lt;\/strong&gt;&#8217;;<br \/>}<br \/>}<br \/>return $plugin_meta;<br \/>}<\/p><\/blockquote>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4f8585e elementor-widget elementor-widget-heading\" data-id=\"4f8585e\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">2. Explanation of the Code<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8a09001 elementor-widget elementor-widget-text-editor\" data-id=\"8a09001\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li><p><strong><code>add_filter( 'plugin_row_meta', 'add_plugin_version_to_row_meta', 10, 2 )<\/code><\/strong>: This function hooks into the <code>plugin_row_meta<\/code> filter. We pass the custom function <code>add_plugin_version_to_row_meta<\/code> which will modify the plugin&#8217;s metadata.<\/p><\/li><li><p><strong><code>if ( $plugin_file == 'your-plugin-folder\/your-plugin-file.php' )<\/code><\/strong>: This condition ensures that the code only runs for the specific plugin you want to modify. Replace <code>'your-plugin-folder\/your-plugin-file.php'<\/code> with the actual file path of your plugin.<\/p><\/li><li><p><strong><code>get_plugin_data()<\/code><\/strong>: This function retrieves the plugin header data, including the version number, from the plugin file.<\/p><\/li><li><p><strong><code>$plugin_meta[]<\/code><\/strong>: Adds the plugin version to the <code>$plugin_meta<\/code> array, which is then displayed in the plugin&#8217;s row meta section.<\/p><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3855e6e elementor-widget elementor-widget-heading\" data-id=\"3855e6e\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">3. Save and Test<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-244849e elementor-widget elementor-widget-text-editor\" data-id=\"244849e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Once you\u2019ve added the code, save the file and navigate to the <strong>Plugins<\/strong> page in the WordPress dashboard. You should now see the plugin version displayed in the meta information beneath the plugin name.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b8db2f8 elementor-widget elementor-widget-heading\" data-id=\"b8db2f8\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Why Add Plugin Version to plugin_row_meta?\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f46bcfc elementor-widget elementor-widget-text-editor\" data-id=\"f46bcfc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>There are several reasons why adding the plugin version to <code>plugin_row_meta<\/code> can be beneficial:<\/p><ol><li><p><strong>Quick Version Reference<\/strong>: For developers and site managers maintaining multiple plugins, being able to quickly view the current version of a plugin from the admin interface helps manage updates more efficiently.<\/p><\/li><li><p><strong>Improved User Experience<\/strong>: When distributing a plugin, users can see the version directly on the Plugins page, adding transparency and trustworthiness to the plugin.<\/p><\/li><li><p><strong>Easier Debugging<\/strong>: If you\u2019re troubleshooting plugin conflicts or issues, knowing the plugin version without needing to open the plugin files can save time.<\/p><\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-12dedc6 elementor-widget elementor-widget-heading\" data-id=\"12dedc6\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Extending Functionality: Adding More Meta Information\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-507fe51 elementor-widget elementor-widget-text-editor\" data-id=\"507fe51\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>You can go beyond just adding the plugin version and include other useful metadata. For example, you might want to include the plugin&#8217;s last update date, author, or a changelog link.<\/p><p>Here\u2019s how you can modify the code to include more data:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0af5b5e elementor-widget elementor-widget-text-editor\" data-id=\"0af5b5e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<blockquote><p>add_filter( &#8216;plugin_row_meta&#8217;, &#8216;add_custom_plugin_meta&#8217;, 10, 2 );<\/p><p>function add_custom_plugin_meta( $plugin_meta, $plugin_file ) {<br \/>if ( $plugin_file == &#8216;your-plugin-folder\/your-plugin-file.php&#8217; ) {<br \/>$plugin_data = get_plugin_data( WP_PLUGIN_DIR . &#8216;\/&#8217; . $plugin_file );<br \/>$version = isset( $plugin_data[&#8216;Version&#8217;] ) ? $plugin_data[&#8216;Version&#8217;] : &#8221;;<br \/>$author = isset( $plugin_data[&#8216;Author&#8217;] ) ? $plugin_data[&#8216;Author&#8217;] : &#8221;;<br \/>$last_updated = &#8216;Last updated on &#8216; . date(&#8216;F j, Y&#8217;, filemtime( WP_PLUGIN_DIR . &#8216;\/&#8217; . $plugin_file ) );<\/p><p>if ( $version ) {<br \/>$plugin_meta[] = &#8216;&lt;strong&gt;&#8217; . esc_html__( &#8216;Version: &#8216;, &#8216;text-domain&#8217; ) . $version . &#8216;&lt;\/strong&gt;&#8217;;<br \/>}<\/p><p>if ( $author ) {<br \/>$plugin_meta[] = esc_html__( &#8216;Author: &#8216;, &#8216;text-domain&#8217; ) . $author;<br \/>}<\/p><p>$plugin_meta[] = $last_updated;<br \/>}<br \/>return $plugin_meta;<br \/>}<\/p><\/blockquote>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-442faf0 elementor-widget elementor-widget-text-editor\" data-id=\"442faf0\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>This will display additional information like the plugin author and the date when the plugin was last modified.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Adding the plugin version to the plugin_row_meta section in WordPress can be a useful way to display extra information about a plugin directly on the WordPress admin plugins page. This can help developers or site administrators quickly see the plugin version without needing to check the plugin files or visit the plugin settings. In this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2041,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-2040","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-tutorial"],"_links":{"self":[{"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/posts\/2040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/comments?post=2040"}],"version-history":[{"count":0,"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/posts\/2040\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/media\/2041"}],"wp:attachment":[{"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/media?parent=2040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/categories?post=2040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aaradhanakalakendra.in\/blog\/wp-json\/wp\/v2\/tags?post=2040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}