How to get submenu of admin menu?

You can use the global variable $submenu. Example to list the child menu of parent post menu:- function admin_init_callback() { global $submenu; $sumenu_list = $submenu[‘edit.php’]; var_dump($sumenu_list); //array of submenu } add_action(‘admin_init’, ‘admin_init_callback’, 999); Profi660 EDIT: Not needed to be used with admin_init hook. I used this in my plugin page and worked very well.

Show global Message in User Profiles with admin only Input field in WordPress Backend

You just need to move the capability check “inwards”: function wpse_230369_quote_of_the_day( $user ) { $quote = esc_attr( get_option( ‘quote_of_the_day’ ) ); ?> <div class=”visible-only-for-admin”> <h3>Quote of the Day Input Field</h3> <table class=”form-table” > <tr> <th><label for=”quote_of_the_day”>Quote of the Day</label></th> <td> <?php if ( current_user_can( ‘administrator’ ) ) : ?> <input type=”text” name=”quote_of_the_day” value=”<?php echo $quote … Read more

Admin: how to make a custom list filter button send GET queryvars

Thanks to @cybmeta I was able to solve my issue. Below I post all the relevant code. Keep in mind it refers to a ‘distributor’ custom post type that uses 4 custom taxonomies (‘italy’,’france’,’spain’,’world’). // add columns function add_distributor_columns($table_columns){ $area_column = array(‘area’ => ‘Area’); $macroarea_column = array(‘macroarea’ => ‘Macroarea’); // put them on the right … Read more

Why does Thickbox jQuery load on my site?

You are perfectly right, ThickBox is old and it supposes to be present in admin Dashboard only, but beeing able to change this kind of behavior makes WordPress great (and sometimes not). Every theme or plugin can actually call this library for his help with the wp_enqueue_script(‘thickbox’) function or it can use it as a … Read more

Remove value from array within post meta ajax admin

You’re not printing anything from the AJAX callback. Trying using wp_send_json_success: function ajaxtestdel(){ global $post; $currentPdfs = get_post_meta( $post->ID, ‘pdf_upload_url’, true ); $postValue = isset($_POST[‘postid’]) ? $_POST[‘postid’] : ”; $array_without_strawberries = array_diff($currentPdfs, array($postValue)); update_post_meta( $post->ID, ‘pdf_upload_url’, $array_without_strawberries ); // Send something back to AJAX wp_send_json_success(); } I have a feeling that perhaps your jQuery selector … Read more

Is it possible to restrict access to specific pages in the admin area based on the page slug?

So following from the comment discussion, a sufficient answer on another StackEx question goes like this: add_filter( ‘parse_query’, ‘exclude_pages_from_admin’ ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() && $pagenow==’edit.php’ && $post_type ==’page’) { $query->query_vars[‘post__not_in’] = array(’21’,’22’,’23’); } } The only part that’s terribly important to us is the array of post IDS. The problem is … Read more

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