Title: [Plugin: Media Tags]  Row count fix [!]
Last modified: August 20, 2016

---

# [Plugin: Media Tags] Row count fix [!]

 *  [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-media-tags-row-count-fix/)
 * I spent a lot of time debugging for this.
 * Fixes:
    – Assigning a new row count to Screen Options doesn’t work in Media->
   Media-Tags page (3.2-RC3). – Proper WP hook to fix the lost of focus when clicking
   Media->Media-Tags. (Props to Dion Hulse [WP dev] for hinting the proper way to
   hook for this. Ref inside.)
 * media-tags\mediatags_admin.php li ~315
 *     ```
       ////
       ////[alx359] Multiple fixes for the Media-Tags page
       ////
   
       /*
       	// Adds the 'Media-Tags' submenu option under the Media nav
   
       	add_media_page( _x("Media-Tags", 'menu label', MEDIA_TAGS_I18N_DOMAIN),
       					_x("Media-Tags", 'page label', MEDIA_TAGS_I18N_DOMAIN),
       					MEDIATAGS_MANAGE_TERMS_CAP,
       					"edit-tags.php?taxonomy=media-tags" );
       */
   
       	// Adds the 'Media-Tags' submenu option under the Media nav, but with a new post_type hook
       	// [http://wordpress.org/support/topic/adding-a-media-submenu-issues]
       	add_media_page('Media-Tags', 'Media-Tags', 'upload_files', "edit-tags.php?taxonomy=media-tags&post_type=attachment" );
   
       	function mediatags__edit_tags_fixes($parent_file)
       	{
       		if ( 'edit.php?post_type=attachment' == $parent_file )
       		{
       			// back-reference to Media menu, to fix proper side-menu focus
       			$parent_file = 'upload.php';	
   
       			// Give 'Show on screen' form other names, to avoid conflict with some WP filters (e.g. do not use - )
       			add_screen_option( 'per_page', array('label'  => 'Media-Tags', 'default' => 20,
       												 'option' => 'edit_mediatags_per_page',
       												 'value'  => 'edit_mediatags_per_page') );	
   
       			// Fix for 'Show on screen' form processing, to make applied rows work
       			// (code extracted from set_screen_options(), as I don't know yet how to hook this)
       			if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) )
       			{
       				check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
       				if ( !$user = wp_get_current_user() ) return;
       				$option = $_POST['wp_screen_options']['option'];
       				$value  = $_POST['wp_screen_options']['value'];
   
       				// persist applied values in wp_usermeta table
       				update_user_meta($user->ID, $option, $value);
       				// redirect to set cookie
       				wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
       			}
       			return $parent_file;
       		}
       	}
       	add_action('parent_file', 'mediatags__edit_tags_fixes');
   
       ////
       ////
       ////
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Paul Menard](https://wordpress.org/support/users/pmenard/)
 * (@pmenard)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-media-tags-row-count-fix/#post-2166019)
 * Thanks for the code patch. Guess I’m confused on the actual issue this is supposed
   to correct.
 *  Plugin Author [Paul Menard](https://wordpress.org/support/users/pmenard/)
 * (@pmenard)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-media-tags-row-count-fix/#post-2166020)
 * Never mind I see what this does. You are forcing the post_type for the edit tag
   URL. Cool. Thanks. Was not sure this was an issue.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Media Tags] Row count fix [!]’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/media-tags.svg)
 * [Media Tags](https://wordpress.org/plugins/media-tags/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-tags/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-tags/)
 * [Active Topics](https://wordpress.org/support/plugin/media-tags/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-tags/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-tags/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Paul Menard](https://wordpress.org/support/users/pmenard/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-media-tags-row-count-fix/#post-2166020)
 * Status: not resolved