root-relative links for multiple parked domains

I tracked the function calls in my theme (a child theme of Oenology by Chip Bennett) and wp-include that generate the links, found the home_url() function, and then wrote these functions for my site: function gregory_make_relative($url=””) { return preg_replace( ‘#^https?://[^/]+/#iu’, “https://wordpress.stackexchange.com/”, $url, 1 ); } add_filter( ‘home_url’, ‘gregory_make_relative’, 11, 1 ); I intentionally grep-searched to … Read more

get_category_link() is returning nothing

You should be using get_term_link instead, also for consistencys sake and to future proof, use get_terms instead of get_categories. Both work on categories/tags and all custom taxonomies. Also check for the return of a WP_Error object ( returned when an invalid or nonexistent term is passed )

Count and show Clicks on external links in a single page/post

Yes, it is possible. You can do this with ajax call that updates post meta field before the link is followed. In the example, I used admin and non-admin users who click the link and automatic increase link_check_click_counter in the post meta. I used here the example to show the data using wp_footer. You can … Read more

Creating a Link Directory using WordPress?

A great starting point would be Mike’s answer to the question about cloning CrunchBase. You’ll want to do something similar with custom post types for entries in your directory. If you want to allow visitors to submit sites, you could perhaps use the TDO Mini Forms plugin to allow visitors to create a new listing, … 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’.

How can I link to the most recent post in a category?

It’s not built into core, but it’s certainly possible to add, however – I wouldn’t consider it a good idea to have a single post available at multiple URLs, so a redirect is probably best. Of course, it will require a bit of PHP, as WordPress doesn’t operate on magic or willpower. First, we hook … Read more