Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9130547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:59:01+00:00 2026-06-17T07:59:01+00:00

For images uploaded using WordPress’ media uploader, there is an Insert Into Post button

  • 0

For images uploaded using WordPress’ media uploader, there is an “Insert Into Post” button that sends a shortcode to the editor for that image.

I have a text input that, when focused, I’d like the media uploader to appear so that the user can select an image and send the file URL to the text input.

The main issue I’m having is creating the additional “Insert Into Post” button that sends the file URL to the appropriate text field.

Which hook do I use for that and how can I get the file URL data returned to the input field?

Your guidance is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:59:02+00:00Added an answer on June 17, 2026 at 7:59 am

    What you’ve described is the older WordPress way of doing it… If you want to use the new uploader in WordPress 3.5+, you can create a wp.media object to upload it, similar to the code in wp-admin/js/custom-background.js:

               // Create the media frame.
                frame = wp.media.frames.customBackground = wp.media({
                    // Set the title of the modal.
                    title: $el.data('choose'),
    
                    // Tell the modal to show only images.
                    library: {
                        type: 'image'
                    },
    
                    // Customize the submit button.
                    button: {
                        // Set the text of the button.
                        text: $el.data('update'),
                        // Tell the button not to close the modal, since we're
                        // going to refresh the page when the image is selected.
                        close: false
                    }
                });
    
                // When an image is selected, run a callback.
                frame.on( 'select', function() {
                    // Grab the selected attachment.
                    var attachment = frame.state().get('selection').first();
    
                    // Run an AJAX request to set the background image.
                    $.post( ajaxurl, {
                        action: 'set-background-image',
                        attachment_id: attachment.id,
                        size: 'full'
                    }).done( function() {
                        // When the request completes, reload the window.
                        window.location.reload();
                    });
                });
    
                // Finally, open the modal.
                frame.open();
    

    the frame.on('select' function(){ code is run when a file is chosen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've uploaded my images using the WordPress Media Library. Permissions are set on the
I'm using this piece of code I found ( http://impnerd.com/wordpress-hack-add-post-images-to-your-homepage ) to display the
I'm running into some trouble validating uploaded images using the new IValidatabeObject interface in
Django-imagekit, which I'm using to process user uploaded images on a social media website,
I'm using Wordpress and user-uploaded images. I'm trying to build a responsive image gallery
I have images uploaded in the media library in WordPress. I would like to
I just switched from storing my images uploaded via Carrierwave locally to using Amazon
I'm using the great jquery-file-upload image uploader, but need to store images for different
I have an asp.net mvc application that allows images to be uploaded. I am
I am using imagekit to handle custom size of uploaded images. While it works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.