Admin menu post type

Yes you can do that. Use function add_menu_page http://codex.wordpress.org/Function_Reference/add_menu_page to add parent “All post types”, then use add_submenu_page http://codex.wordpress.org/Function_Reference/add_submenu_page to add pages to parent page: add_action( ‘admin_menu’, ‘my_custom_menu_page’ ); function my_custom_menu_page() { $slug = ‘all-post’; add_menu_page( ‘All post types’, ‘All post types’, ‘edit_posts’, $slug, ‘__return_true’ ); foreach( array( ‘post’, ‘page’, ‘foo’, ‘bar’ ) as $post_type … Read more

Run filter if only it was run from specific admin page ( ‘upload_dir’ changed )

Adding filter: add_filter( ‘upload_dir’, ‘change_upload_dir’, 10, 1 ); Function content: function change_upload_dir($param) { // Check for REFER $actual_page = $_SERVER[‘HTTP_REFERER’]; parse_str( parse_url($actual_page, PHP_URL_QUERY), $query_array ); if ( strpos($actual_page, ‘plugin_name.php’) ) { $mydir=”/customdir”; $param[‘path’] = $param[‘basedir’] . $mydir; } return $param; } Hope this will help Other ideas, based not on HTTP_REFERER, are appreciated 🙂

Only execute specific shortcodes

It’s easier to remove specific shortcodes than it is to remove_all_shortcodes() and enable specific shortcodes. To disable specific shortcodes from display everywhere, you would use the following: <?php add_filter( ‘the_content’, ‘oxo_remove_shortcodes’, 0 ); function oxo_remove_shortcodes( $content ) { /* Add the shortcodes that you would like to remove to the array below. */ $shortcode_tags = … Read more

Appearance > Menus

Using add_menu_page and add_submenu_page is generally used for adding pages to the dashboard to serve a specific purpose, such as accessing the options page for a plugin settings. Using them is unnecessary, however, if your intentions are to add/edit posts/tags/categories to a custom post type (CPT). When a CPT is correctly registered, with it’s corresponding … Read more

Exclude categories For Custom post types

You’d probably be better served by creating a custom taxonomy to accompany your custom post type. That way you can manage terms separate from the built-in categories taxonomy. // Register Custom Taxonomy function wpse_168762_create_gallery_taxonomy() { $labels = array( ‘name’ => _x( ‘Gallery Categories’, ‘Taxonomy General Name’, ‘text_domain’ ), ‘singular_name’ => _x( ‘Gallery Category’, ‘Taxonomy Singular … Read more

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