Generate Advanced Custom Fields box in custom admin menu page

Interesting exercise, a one page plugin that believes it deserves a first level menu page is wrong, IMO. I use the same technique with Jetpack. To create sub-pages in the Options Page add-on, read the documentation. The logic of this menu/sub-menu swapping is: Add multiple ACF Options Pages Create our menu first level page Remove … Read more

Make sub menu items a main link in the admin menu using fuctions.php

OK, it’s a bit messy, but it works. Take a look function remove_submenus() { global $submenu; unset($submenu[‘themes.php’][10]); // Removes Menu } add_action(‘admin_menu’, ‘remove_submenus’); function new_nav_menu () { global $menu; $menu[99] = array(”, ‘read’, ‘separator’, ”, ‘menu-top menu-nav’); add_menu_page(__(‘Nav Menus’, ‘mav-menus’), __(‘Nav Menus’, ‘nav-menus’), ‘edit_themes’, ‘nav-menus.php’, ”, 99); } add_action(‘admin_menu’, ‘new_nav_menu’); Essentially it is removing the … Read more

Is there a way to keep a custom menu expanded when editing a custom post type?

I figured this out by putting the main menu slug into the show_in_menu key of the custom post type array like so: $args = array ( ‘labels’ => $labels, ‘hierarchical’ => FALSE, ‘description’ => $title . ‘s’, ‘supports’ => array( ‘title’ ), ‘show_ui’ => TRUE, ‘show_in_menu’ => ‘squirrels_inventory’, ‘show_in_nav_menus’ => TRUE, ‘publicly_queryable’ => TRUE, ‘exclude_from_search’ … Read more

How to hide menu on WordPress admin

You can do this with remove_menu_page. Add the appropriate menu slug in your functions.php of your theme or your plugin. <?php remove_menu_page( $menu_slug ) ?> Note that users can still access these menus using a direct link. If you intend to block a user from accessing a menu, you will have to set up a … Read more

How do I set up a webhook?

You are using self-hosted WordPress, which sometimes referred to as WordPress.org. Calling remote hook is still a possibility there, but unless your e-commerce solution supports it, you may need to add a custom code. Option – find a plugin There are some plugins which will post data to external URL when certain event happens, say, … Read more

How do I fix this error: Warning: invalid argument supplied for foreach()?

This usually happens when you are trying to do admin navigation stuff and you aren’t hooked into admin_menu. If you hook in before that, $menu hasn’t been created yet. add_action(‘admin_menu’, ‘my_plugin_add_menu’); function my_plugin_add_menu(){ $ptype=”my_post_type”; $ptype_obj = get_post_type_object( $ptype ); add_submenu_page( ‘my-menu-item’, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, “edit.php?post_type=$ptype” ); }

Custom WP_List_Table displays blank rows

You’re getting the blank rows because your column headers are registered late. And you should register the headers (i.e. initialize the list table class instance) before admin notices are rendered on the page, i.e. before WordPress fires hooks like admin_notices. But your customer_list_page() function, which I believe, is a callback for either add_menu_page() or add_submenu_page(), … Read more

Overwriting Core WordPress Functions with Plugins

Not really, no. You can override built-in PHP functions, but not user-defined functions. However, all this function does is define a meta box. Why not define your own? Once you’ve got your own meta box defined and added, you can call remove_meta_box to remove the standard one: remove_meta_box( ‘add-POSTTYPENAME’, ‘nav-menus’, ‘side’); The meta box is … Read more

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