Support » Fixing WordPress » P2 media buttons not appearing

  • Hi!

    I am running 3.0 alpha (latest build) and P2 on my local machine, and there is an issue witht he mdeia uploader buttons: their URL is, so you cannot see the images.

    I believe this is due to the functions below, but I can’t figure out out to solve the issue: I can display the images by removing return P2::make_media_urls_absolute( ob_get_clean() );, but then the buttons won’t work.

    function media_buttons() {
    		include_once ABSPATH . '/wp-admin/includes/media.php';
    		do_action( 'media_buttons' );
    		return P2::make_media_urls_absolute( ob_get_clean() );
    function make_media_urls_absolute( $string ) {
    		$string = str_replace( 'images/', P2::admin_url( 'images/' ), $string );
    		// This line does not work in .org
    		return str_replace( 'media-upload.php?', P2::admin_url( 'media-upload.php?p2-upload=true&' ), $string );

    Can somebody help me with that?


Viewing 5 replies - 1 through 5 (of 5 total)
  • I can’t seem to find any solution to that issue. I have looked, I have tried, but nothing…

    Any idea?

    Seems it is due to a recent modification for WordPress 3.0:

    I keep trying , if anybody has any idea, let me know….

    Moderator Andrew Nacin


    Lead Developer

    I should probably work if you change it to return ob_get_clean();. There is no need for P2 to make URLs absolute anymore, as they are already absolute now.

    It appears the changeset broke an extreme edge use case — P2 employs a very interesting hack in order to get the media buttons on the front end — so I’m not too concerned. Automattic should be able to modify those two functions to allow it to work on both 2.9 and 3.0.

    Thank you! Yuo put me in the correct track!

    I have changed it, but unfortunately it did not complately solve the issue. The images had the correct path, but the links themselves had the wrong one: they had the format, missing the wp-admin there.

    So I have kept return P2::make_media_urls_absolute( ob_get_clean() );,, but I have removed $string = str_replace( 'images/', P2::admin_url( 'images/' ), $string );, and it seems to work.

    Thank you for your help!

    Where are these lines? Which file are you talking about? Or is there another solution by now?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘P2 media buttons not appearing’ is closed to new replies.