permalink for category pages and posts

There’s currently no way in core to get the current archive / category / tag / custom taxonomy URL. I have a patch waiting for that to be added right here. For now though, you could just use the code in the last patch on that ticket: <?php /* Get the current archive link * … Read more

How to update media links in WordPress after migration?

As mentioned in the comments under your question, some data in the WordPress database is serialized and therefore not possible to change with a simple find and replace. You should read through the Moving WordPress section of the codex. Specifically the Changing Your Domain Name and URLs portion. I usually use a plugin or a … Read more

Add query string to plugin URL

When you don’t know if query string was started or not you can use add_query_arg which it knows how to deal with that and adds the “?” or “&” marks (which ever one is needed) to the query string. Update By popular demand I’m adding a few examples that are from the codex: Using get_permalink: … Read more

Remove the http protocol from images

The code you provided could cause issues with 3rd party URLs in hyperlinks not running https. You can fix this by including your home url, e.g: $content = str_replace( set_url_scheme( home_url(), ‘http’ ), set_url_scheme( home_url(), ‘relative’ ), $content); Next, you’re applying this when you’d like to display the content, which means you need to do … Read more