Add menu and submenu in admin with a URL instead of slug?

This is an old post but can’t you just use wordpress $menu and/or $submenu globals like Oleg suggested in number 2. When in doubt copy WordPress: wordpress/wp-admin/menu.php For example to add link this seems like it would work: function add_external_link_admin_submenu() { global $submenu; $permalink = admin_url( ‘edit-tags.php’ ).’?taxonomy=category’; $submenu[‘options-general.php’][] = array( ‘Manage’, ‘manage_options’, $permalink ); … Read more

How to deal with WordPress on localhost

You can use wp-config.php to change the site url depending on where the site is accesed from, using $_SERVER[‘REMOTE_ADDR’]. Mine has something like this: if ($_SERVER[‘REMOTE_ADDR’] == ‘127.0.0.1’ || $_SERVER[‘REMOTE_ADDR’] == ‘::1’) { // accesing site from my local server define(‘WP_SITEURL’, ‘http://localhost/mysite/’); define(‘WP_HOME’, ‘http://localhost/mysite’); } else if (strpos($_SERVER[‘REMOTE_ADDR’],’192.168.0.’) !== false) { // accesing site from … Read more

Difference between esc_url() and esc_url_raw()

From the Codex entry for Data Validation: URLs: esc_url( $url, (array) $protocols = null ) (since 2.8) Always use esc_url when sanitizing URLs (in text nodes, attribute nodes or anywhere else). Rejects URLs that do not have one of the provided whitelisted protocols (defaulting to http, https, ftp, ftps, mailto, news, irc, gopher, nntp, feed, … Read more

Change default URL path (/blog/) of blog posts

You can create any structure you want for this on the permalinks settings page in the dashboard. To set it to your example of /blog/title-of-post Simply navigate to Settings -> Permalink. Select the “Custom Structure” radio button and enter blog/%postname%/ into the text field there, then hit the save changes button.

use query string in URL to display content on the page

Per the OP’s answer within their question: With your help and some Googling, I put together a shortcode that returns the value of any url parameter. Here it is: //THIS IS A CUSTOM SHORTCODE TO DISPLAY A PARAMETER FROM THE URL function URLParam( $atts ) { extract( shortcode_atts( array( ‘param’ => ‘param’, ), $atts ) … Read more