Using audio shortcode for .mp3 URLs with a query string

The problem: The problem seems to be that wp_check_filetype() doesn’t recognize mp3 files with GET parameters. Possible workarounds: You have two options as far as I can see: 1) Override the audio shortcode with the wp_audio_shortcode_override filter. 2) or allow any audio extensions via the wp_audio_extensions filter. Here’s an example how you can implement the … Read more

How to put wordpress site behind AWS load balancer

When WordPress is behind https proxy (your load balancer) it doesn’t know that https is enabled. Proxy is working through https (443 port) but communication between proxy and WordPress is through http (80 port). For WordPress traffic is through http, that’s why you get redirect loop from https to http (by WordPress) and again from … Read more

How can I add programmatically custom taxonomy terms to a custom type post when saving posts?

So, to answer my own question: I haven’t found any solution inside wp_insert_post_data. I suspect that the problem is connected to the fact that when wp_insert_post_data is executed the post in question is not yet in the database. And albeit I didn’t manage to find it in taxonomy.php, it is logical to assume that the … Read more

Upgrade to SSL Breaks Admin Dashboard

Not sure what plugin you are using to enforce SSL, but I would disable it to prevent conflicts with the possible solution below. To make sure you’ve updated all of your URLs to the HTTPS, do the following: Go and download Interconnect IT’s Database Search & Replace Script here Unzip the file and drop the … Read more

Multisite, upload images directly to Amazon S3

If you are running on a dedicated linux server and are comfortable with the command line, you could install s3fs. This is a program that allows you to actually mount your Amazon s3 Bucket as a directory on you server. In the standard multisite environment, media uploads for all sites but the main site are … Read more

Modify featured image path to Amazon S3

You can hook into the output and modify the URL there. add_filter( ‘post_thumbnail_html’, ‘my_post_image_html’, 10, 5 ); function my_post_image_html( $html, $post_id, $post_thumbnail_id, $size, $attr ) { $upload_dir = wp_upload_dir(); $base_url = $upload_dir[‘baseurl’]; // Change the default upload directory to AWS Bucket link $AWSBucket=”http://s3.amazonaws.com/bucket”; $html = str_replace($base_url, $AWSBucket, $html); return $html; } Output the image echo … Read more

How does W3 Total Cache CDN URL rewrites work? [closed]

The W3 Total Cache plugin changes the URL of various files in /w3-total-cache/lib/W3/Plugin/Cdn.php in the function *ob_callback*. It uses a series of callbacks to modify an output buffer. The code runs like this: w3_total_cache.php calls $root->run(); W3_Root::run calls $plugin->run() for each plugin in $this->_loaded_plugins W3_Plugin_TotalCache::run starts an output buffer which calls W3_Plugin_TotalCache::ob_callback W3_Plugin_TotalCache::ob_callback calls w3tc_do_ob_callbacks() … Read more