Title: Patch thickbox 404 errors in p2 theme
Last modified: August 19, 2016

---

# Patch thickbox 404 errors in p2 theme

 *  [n8v](https://wordpress.org/support/users/n8v/)
 * (@n8v)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/)
 * I don’t know if there’s a better place to submit this but I was noticing 404 
   errors on a couple of images (loadingAnimation.gif and tb-close.png) from the
   thickbox media uploader on the p2 front page new post form.
 * By default the media uploader uses relative paths starting with `../` because
   it runs inside wp-admin/. The fix, [since WP 2.8.4](https://core.trac.wordpress.org/ticket/6453#comment:11)
   is to override the location inside p2’s post-form.php :
 *     ```
       ===================================================================
       --- post-form.php       (revision 13036)
       +++ post-form.php       (working copy)
       @@ -1,4 +1,8 @@
               <script type="text/javascript" charset="utf-8">
       +                /* properly reference thickbox images */
       +                var tb_pathToImage = "./wp-includes/js/thickbox/loadingAnimation.gif";
       +                var tb_closeImage = "./wp-includes/js/thickbox/tb-close.png";
       +
                       jQuery(document).ready(function($) {
       ```
   
 * Oh also, I’m using WordPress 3.1-alpha from the SVN trunk and a SVN checkout 
   of the p2 v 1.1.5 tag/branch.

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [Lance Willett](https://wordpress.org/support/users/lancewillett/)
 * (@lancewillett)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1591738)
 * Hi n8v,
    This forum is the correct place to report errors, and thanks for your
   report.
 * I’m not able to reproduce the 404 errors running the same setup you mentioned.
   Both those images load fine in my testing. P2 loads `/wp-admin/includes/media.
   php` directly, so the image paths should work fine as defined by default.
 *  Thread Starter [n8v](https://wordpress.org/support/users/n8v/)
 * (@n8v)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1591785)
 * hmmm… you went to the homepage of a p2-themed blog,
    clicked on the “add image”
   icon on the new post form (html id = `add_image`), and got the thickbox “popup”
   with a working close icon (tb_close.png) in the upper right?
 *  [Lance Willett](https://wordpress.org/support/users/lancewillett/)
 * (@lancewillett)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1591808)
 * Affirmative. No 404 errors reported in Firebug using the “Net” tab to track images
   loading on the page.
 *  Thread Starter [n8v](https://wordpress.org/support/users/n8v/)
 * (@n8v)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1591936)
 * Weird.
 *  [webjac](https://wordpress.org/support/users/webjac/)
 * (@webjac)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592152)
 * I’m having the same error in all my p2 installations.
 * I’m using the latest version 1.2.3
 * The icons for media upload point to the wrong link.Let me elaborate on this:
 * If my blog is at: [http://mydomain.com/blog](http://mydomain.com/blog)
 * The media upload should point to: [http://mydomain.com/blog/wp-admin/includes/media.php](http://mydomain.com/blog/wp-admin/includes/media.php)
 * But instead it goes to: [http://mydomain.com/blog/blog/wp-admin/includes/media.php](http://mydomain.com/blog/blog/wp-admin/includes/media.php)
 * Giving then a 404 error because of the duplicated “blog/” in the link.
 * How can I fix that?
 *  [yasodhara](https://wordpress.org/support/users/yasodhara/)
 * (@yasodhara)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592155)
 * Same error for me.
    The problem is an extra /wordpress/ in the path (like the
   extra /blog/ on webjac’s installs) How to fix?
 *  [ChevignoN](https://wordpress.org/support/users/chevignon/)
 * (@chevignon)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592156)
 * I’m trying to solve this problem.
 * For the moment i can change the first link when you click.
 * But then for the upload it still don’t works …
 * In the p2.php
 *     ```
       function admin_url( $path ) {
       		return $path;
   
       		// ANCIEN LIEN DE BASE
       		//return P2::url_filter( admin_url( $path, 'http' ) );
       	}
   
       	function make_media_urls( $string ) {
       		// This line does not work in .org
       		return str_replace( 'media-upload.php?', P2::admin_url( '/inside-ajilon/wordpress/wp-admin/media-upload.php?p2-upload=true&' ), $string );
   
       		// ANCIEN LIEN DE BASE
       		//return str_replace( 'media-upload.php?', P2::admin_url( '/media-upload.php?p2-upload=true&' ), $string );
       	}
       ```
   
 * _[Please post code snippets between backticks or use the code button.]_
 *  [NathanBecker](https://wordpress.org/support/users/nathanbecker/)
 * (@nathanbecker)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592159)
 * same problem Upload/Insert <a href=”[http://tap2post.com/dt/dt/](http://tap2post.com/dt/dt/)
 * where’s that extra /dt coming from 🙁
 *  [yasodhara](https://wordpress.org/support/users/yasodhara/)
 * (@yasodhara)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592164)
 * This is 90% solved:
    I know this is a hack, but commenting out line 66 of p2/
   inc/p2.php fixes the problem for us.
 * [http://wordpress.org/support/topic/p2-123-clicking-add-media-opens-up-error-page?replies=5#post-1992957](http://wordpress.org/support/topic/p2-123-clicking-add-media-opens-up-error-page?replies=5#post-1992957)
 *  [jasonashaw](https://wordpress.org/support/users/jasonashaw/)
 * (@jasonashaw)
 * [15 years ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592171)
 * Solved this problem with a simple general setting change.
 * see [http://wordpress.org/support/topic/p2-123-clicking-add-media-opens-up-error-page?replies=8#post-2136945](http://wordpress.org/support/topic/p2-123-clicking-add-media-opens-up-error-page?replies=8#post-2136945)
 * change the site URL.
 * blog URL [http://www.sitename.com/p2/](http://www.sitename.com/p2/)
    site URL
   [http://www.sitename.com/](http://www.sitename.com/)
 * that’s it!
 * Best,
    Jason
 *  [schvenk](https://wordpress.org/support/users/schvenk/)
 * (@schvenk)
 * [15 years ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592173)
 * Changing site name solves this for the media uploaded, but I’m having the same
   problem elsewhere (for instance, on the image for the close box on the media 
   uploader) even with that fix. Note that in my case the WP install is more than
   one directory level deep.
 *  [Ryan Gatto](https://wordpress.org/support/users/catonthecouchproductions/)
 * (@catonthecouchproductions)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592175)
 * We covered this a few week back on our blog, [http://www.catonthecouch.com/blog](http://www.catonthecouch.com/blog).
 * Best of luck

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Patch thickbox 404 errors in p2 theme’ is closed to new replies.

 * 12 replies
 * 9 participants
 * Last reply from: [Ryan Gatto](https://wordpress.org/support/users/catonthecouchproductions/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/patch-thickbox-404-errors-in-p2-theme/#post-1592175)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
