WordPress.org

Ready to get started?Download WordPress

Forums

Modified Media-upload Link (2 posts)

  1. Davidsdesk
    Member
    Posted 1 year ago #

    I have a WordPress MU site with static pages that each contain an image gallery and nothing else - no text content. Each time a new user signs up they get a pre-populated site. Rather than having them navigate to the individual pages and click the small image-upload icon I have copied that link an attached it to an image map on the WordPress dashboard. It works fine. The user logs in, clicks the "Add an image to my Home page" icon on their dashboard, and up pops the media upload dialog box for that particular page. The problem is that the media-upload link uses the post_id, which changes each time a new site is created. I would like to use the post_slug instead. I have tried the following, but it does not work.

    The default link works - http://www.mysite.com/wp-admin/media-upload.php?post_id=123&TB_iframe=1
    
    My link using post-slug does not - http://www.mysite.com/wp-admin/media-upload.php?post_slug=my-page-name&TB_iframe=1

    Does anyone have any advice?

    Thanks,

    David

  2. bcworkz
    Member
    Posted 1 year ago #

    media-upload.php does not appear to understand any post identifying means other than ID. So when the link is built, you somehow have to get the correct ID. If the only thing you have is the slug, and nothing else is available, you could query for the page by slug and get the ID from the returned variables. I don't think there's a function that does this, so you'd have to build your own.

Topic Closed

This topic has been closed to new replies.

About this Topic