Search and replace image urls in posts

I coudn’t solve it with a plugin or plain SQL, see this other question. Instead I exported all the posts with Tools > Data export > WordPress and deleted the posts. Then I run this python script over the exported XML file and imported the update xml file again. Tadaa… import re p = re.compile(r’http://([^/]*)/getfile/files.posterous.com/([^/]*)/([^/]*)/([^/]*)’) … Read more

Removing all my hardcoded URLs with get_site_url()

You actually already were pretty close: function autoblank($text) { $return = str_replace(‘href=”https://wordpress.stackexchange.com/questions/138730/,”target=”_blank” href=”, $text); $return = str_replace( “target=”_blank” href=”‘ . get_site_url(), ‘href=”‘ . get_site_url(), $return ); $return = str_replace(‘target=”_blank” href=”#”https://wordpress.stackexchange.com/questions/138730/,”href=”#’, $return); return $return; } add_filter(‘the_content”https://wordpress.stackexchange.com/questions/138730/,”autoblank’); add_filter(‘comment_text”https://wordpress.stackexchange.com/questions/138730/,”autoblank’);

Create custom URL with different levels

On a very basic level, sub-pages inherit the URL segment of their parent page. A bit more complex, when creating custom taxonomies and custom post types you can define their slug for the WP rewrite engine. The documentation: http://codex.wordpress.org/Taxonomies#Custom_Taxonomies Neither is exactly what you’re looking for… Writing to .htaccess wouldn’t be that hard.

Setting name of attachment URL

You can hook onto add_attachment and force the slug to work off the filename like so: Update: To uppercase the slug, you’ll need to add a temporary filter onto wp_unique_post_slug. You can’t simply use strtoupper( $slug ) as WordPress sanitises (lowercases) it within the update function. /** * Force attachment slug to ignore title from … Read more

Why am I seeing ‘yes’ and ‘no’ in URLs crawled by Xenu?

I resolved the problem – we’re using the Zemanta Related Posts and somehow that was adding references to missing thumbnail images with src=”https://wordpress.stackexchange.com/questions/141273/yes” and src=”no”. Regenerating the missing thumbnail images got rid of this problem.

How to set global variable in functions.php

You can turn your snippet into a function that returns the post thumbnail URL of a post: function wpse81577_get_small_thumb_url( $post_id ) { $thumbSmall = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), ‘small’ ); return $thumbSmall[‘0’]; } Usage, supplying the ID of a post: <?php echo wpse81577_get_small_thumb_url( 59 ); ?>