remove other tabs in new wordpress media gallery

If you want to hide the Media Library submenu: you can do it via the admin_menu action: function wpse85351_hide_submenus() { if(!current_user_can(‘edit_posts’)){ global $submenu; unset($submenu[‘upload.php’][5]); // hide the Media Library } } add_action(‘admin_menu’, ‘wpse85351_hide_submenus’); If you want to change/remove the Media strings: you can use the media_view_strings filter: function wpse85351_media_strings($strings) { // only for subscribers: if(!current_user_can(‘edit_posts’)){ … Read more

About Hooks and Filters

Seeing that you’ve referenced 3 Genesis Developers, i’d like to answer this question using 2 Genesis code snippets as well as 2 WordPress examples of action hooks and filters. Hooks Different template files in Genesis include hooks which simply enable you to execute PHP code in that position of the template. Here’s a visual guide … Read more

Search with filters and title

First, you are setting $_GET[‘filterN’] but you are trying to use $_GET[‘condition_N’]. That is not ever going to work right. Secondly, pagename is an “exact match” value, not a search parameter, and it only works with the “Page” post type (at least so far as I can tell). You are using a CPT and, presumably, … Read more

How to apply content filter permanently?

//run once $allposts = get_posts(‘post_status=publish&numberposts=-1’); foreach ($allposts as $thispost) { wp_update_post( array( ‘ID’ => $thispost->ID, ‘post_content’ => fix_zip_code($thispost->post_content) ) ); } But as Rarst mentioned, backup your database before doing anything…

Am I using the right hook for removing quicktags on the admin TinyMCE?

After checking out the code, the best way to do this would be to use the wp_editor_settings filter in /wp-includes/class-wp-editor.php. When you call wp_editor() it internally makes a call to _WP_Editors::editor($content, $editor_id, $settings);. This function first passes the $settings array through parse_settings() which uses that filter. add_filter( ‘wp_editor_settings’, ‘remove_editor_quicktags’, 10, 2 ); function remove_editor_quicktags( $settings, … Read more

add class to internal links in content

i didn’t want to use js, i wanted a php solution, plus i also manipulate all internal links into anchor links. in the end, you have to decide for yourself, what would be the best way for you, php or js. this goes into functions.php inside the current theme folder. add_filter(‘the_content’, ‘crawl_content’); function crawl_content( $text … Read more

WordPress 3.5+ upload tool filter

The library parameter is actually responsible of what you see in the library frame and not what you can upload. It accepts : image,audio,video,file or any other mime type for example to show only pdf’s : library: { type: ‘application/pdf’ }, Now to actually limit the upload to a file type you need to add … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)