Using filters to change href of nav menu page link

You are on right track, with few minor kinks. You need to modify $atts and return it. Any arguments after the first one are provided for information and should not be changed. You need to tell add_filter() that you expect more than one argument. The example with some debug code would be along the lines … Read more

opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);

I am not sure if there’s a native function for this, but a little regex might help the case: function open_links_in_new_tab($content){ $pattern = ‘/<a(.*?)?href=[\'”]?[\'”]?(.*?)?>/i’; $content = preg_replace_callback($pattern, function($m){ $tpl = array_shift($m); $hrf = isset($m[1]) ? $m[1] : null; if ( preg_match(‘/target=[\'”]?(.*?)[\'”]?/i’, $tpl) ) { return $tpl; } if ( trim($hrf) && 0 === strpos($hrf, ‘#’) … Read more

Is it possible to link to draft pages?

I should start off by saying that linking to drafts will only work for logged in users (with appropriate permissions) – other users will simply hit a 404 Not Found! You’d be much better off getting all your content ready & published, or only link to it once it is ready! Nevertheless, to answer your … Read more

Links redirecting to localhost after migration to server

if anyone comes across with this issue, I resolved it by editing both the ‘home’ and ‘siteURL’ fields in the wp-options table of the database on the server (not the localhost one) to replace the ‘localhost/wordpress’ with ‘http://www.youehostedsitename‘. replace Both ‘home’ and ‘siteurl’.

Default Image Link Removal

This is not able to be changed through a filter. In WordPress 2.9.2 and lower, the setting can be changed in /wp-admin/options.php. The image_default_link_type field is set to “file” by default. If you set it to “none”, then scroll to the bottom and save, it will disable media links. This option has been removed from … Read more