Add-action in function

You can simply remove those menu items in your check_username method. add_action(‘admin_init’, ‘check_username’); function check_username() { $user = wp_get_current_user(); if( $user && isset($user->user_email) && ‘[email protected]’ == $user->user_email ) { remove_menu_page(‘tools.php’); remove_menu_page(‘themes.php’); remove_menu_page(‘options-general.php’); remove_menu_page(‘plugins.php’); } } Your code doesn’t work, because the admin_init action is invoked after admin_menu. Please see the Action reference page in WordPress … Read more

WordPress site seems convinced that it’s still at its old URL

Silly mistake on my part, At some point I defined my wp-content directories right in wp-config. define( ‘WP_CONTENT_DIR’, ‘/home/user/public_html/site/subdirectory/wp-content’ ); define( ‘WP_CONTENT_URL’, ‘http://www.seocial.ly/site/subdirectory/wp-content’ ); Completely overlooked this when editing my wp-config.

Anchor Text code string is automatically modified by WordPress

Your problem is that you are using relative URLs– that is URLs, that include only part of the web address. What is taking on your URL is the browser, not WordPress. Browsers have long done this. Here is how it is supposed to work. If you provide an absolute URL nothing happens– for example, http://www.example.com. … Read more

Adding two submenus to a menu

Hope you’ll find this well , I’m adding the code below. This is one of the way of doing it, you can do things in other ways also. add_action(‘admin_menu’,’create_admin_menu’); function create_admin_menu() { add_menu_page ( ‘Page Title’, ‘Top level menu Title’, ‘manage_options’, ‘your_unique_slug’, ‘your_magic_function’ ); function your_magic_function() { include_once(‘first.php’); } add_submenu_page ( ‘your_unique_slug’, ”, ”, ‘manage_options’, … Read more

Display Custom Post Type in Custom Taxonomy URL

You can use WordPress’ ability to accept custom rewrite rules to get this done. You can add the following to your functions file, or create a plugin (recommended). function url_rewrites_wpanswers() { add_rewrite_rule(‘/custom-post-type-slug/([^/]*)?$’,’index.php?post_type=custom-post-type-name&custom-taxonomy-name=$matches[1]’, ‘top’); //lets you use /posttype/customtaxterm } add_action(‘init’,’url_rewrites_wpanswers’); You would have to add a line for each since otherwise yoursite.com/something1/something2 would end up pointing … Read more