i cant say I’ve tried this but if you have the url of the file and all you need is the file name then you can just change your code from this:
window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
jQuery('#upload_image').val(imgurl);
tb_remove();
}
to this:
window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
filename = substring(imgurl.lastIndexOf("https://wordpress.stackexchange.com/"), imgurl.length);
jQuery('#upload_resource').val(filename);
tb_remove();
}
and this way your “send to editor” button will insert just the file name.
Related Posts:
- limit selection of custom taxonomies to one?
- jQuery UI in Admin (Best Practice?)
- Getting a div content of a post in wordpress?
- Debug whats going on inside a function called from AJAX
- How to save the checked boxes?
- Timepicker-addon doesn’t show – Datepicker works fine?
- Query Custom Post Types & category_name?
- different template for first and second level custom post page
- Filter categories of posts with checkboxes
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- Open div inside a custom post-type with Fancybox
- Getting the URL of the parent page
- Custom post type – use ajax to display sub pages
- Load Next Posts With AJAX not working with custom post type
- Dynamically output a class to an anchor tag depending on what tag is chosen
- Why won’t this jQuery code work?
- Custom Post Type Slick Slider “$ is not a function”
- WordPress notification if new post published
- passing values from functions.php to template
- How to Query in WordPress which shows Alphabetic Posts?
- Revert to previous dropdown options after change
- Creating a Tabbed Widget
- How can I implement jQuery plugin correctly with my CPT?
- Masonry Append WordPress posts with singleMode
- Displaying information from custom field on custom post type
- I can’t connect my custom jquery to wp admin
- Weird issue where form field loses focus to previous form field even with JS disabled
- Display custom-post type based on the Title matching the current selected value
- jQuery UI & Admin (Calendar)
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- How to submit the date with ajax?
- How can I create a button that when clicked populates a div with a list of foods that are checked as a certain type of ACF?
- Disable button after one click per user per post
- how to display new private message to users?
- load wordpress events into full calendar jquery
- CPT not entering jQuery ready state
- Filterable portfolio in WordPress using jQuery isotope
- Collect custom post in a calendar
- Submitting custom post from frontend,jQuery ajax, and custom validation – can’t find proper place to insert wp_insert_post()
- jQuery tab_title already in use
- Toggle a metabox based on a selection
- Loops running into each other
- Add text to metabox input text field from Thickbox
- Add a class to a menu item depending on a body class
- How do loop categories post from according in WordPress? is it impossible to solve this problem?
- Pull total post count for child category and parent if term ID
- How to use TinyMCE Editor for one of my custom post meta field?
- Display correctly using metabox.io
- My CPT won’t display no matter what I do
- Displaying Custom Posts on a Page
- WordPress Doesn’t Generate Taxonomy Archive
- API Rest Custom Post Type doesn’t return all data
- Custom post Type, child of a Page?
- Retrieve custom field from Contact Form 7 [closed]
- WordPress randomly shows 404 errors
- Permalinks for custom post type
- How to add a contribute page
- Custom REST endpoints for a custom post type with custom fields
- Create another comment system for CPT
- Custom Post Slug same as Parents Category Slug
- Hide or disallow default custom post type url?
- How to import a custom MySQL DB table into a WordPress custom post type
- Shortcode not working with post counter
- URL rewriting for CTP assigned entity
- Shortcode to display Staff post type based on Location post type and Specialty post type
- WordPress posts page for customer filtering and sorting along with category filter
- Create Connection Between two post types
- Static apple-app-site-association file with wordpress
- WP-ADMIN – Listing all CPT in “posts” listing
- How to have this permalink structure: post_type/postname/custom_inner_page
- A case for Hierarchical Custom Posts
- Disable user from updating certain posts
- Custom title set on quick edit
- Suggested Post and Taxonomy structure
- Problem: wp_query outputs all images on site
- pre_get_posts for custom page builder meta box
- How do I require the specification of term in a custom post type and custom taxonomy?
- Additional section in custom post type permalink
- Disable closing on metaboxes
- Pre-styling post content to display in lightbox
- Custom archive page for CPT UI
- Static page determines as home, but it is not
- Custom Post, set object Taxonomy terms in plugin
- Edit the author of custom post type
- CPT Template Not Showing – Getting 404
- Query Custom Post Type Taxonomy term with multiple parameters
- I am having Trouble to get list of Categories of Custom post Type
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- Display post content with respect to its title?
- Hierarchy and access control for Custom Post Types (CPT)
- Changing default ‘posts’ parameters with register_post_type_args
- Multiple (two) category postings on the same page.
- Admin Column does not populate with data
- Update database from Quick Edit according to Checkbox state of Custom Post Type
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- “Submit for review” for updates on existing posts
- Access to CPT but not to ‘post’ post type
- Auto Complete Search
- Custom Post Type slug same as page name
- How to query WordPress posts bycustom field with a max characters’ length