it was just missing $upload_dir['path'] . "https://wordpress.stackexchange.com/" . $upload_file_name
in
$uploaded_file['attach_id'] = wp_insert_attachment($attachment, $upload_dir['path'] . "https://wordpress.stackexchange.com/" . $upload_file_name);
require_once(ABSPATH . 'wp-admin/includes/image.php');
//Generate the metadata for the attachment, and update the database record.
$attach_data = wp_generate_attachment_metadata($uploaded_file['attach_id'], $upload_dir['path'] . "https://wordpress.stackexchange.com/" . $upload_file_name);
Related Posts:
- How can i force Display names to be the same as Usernames?
- Average Account Age
- Auto populate a user custom field from another user custom field
- Get all user meta_keys and then group users by matching values
- Where the Nickname is being used in WordPress
- How to get user-meta from Social Login registered users?
- How to create custom LOGIN and REGISTRATION forms?
- delete_user_meta Delete one value out of array
- Will WordPress username displayed somewhere in the site?
- Displaying a Welcome Message to a Woocommerce User
- update_user_meta add value on the top on existing value
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- WordPress Central User Database
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- Custom User meta field display
- How to create multiple users at once?
- Shortcode to update user meta
- WordPress /users/me endpoint request forbidden
- Linking form to user meta fields
- User updating their profile wipes my custom fields
- How To Export User’s Custom Fields in CSV or XLSX
- Searchable Semi Random Number Generator on User Profiles
- User / membership Plugin [closed]
- Confusing problem with displaying message recipient metadata
- Users Ultra: Hide asterisk for required registration fields?
- Need help getting a certain value out of a multi dimensional array
- User register hook can’t access form request
- Create Unique and Customized User ID for Website Members in WordPress
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- Is there a plugin or resource for custom implementation for OAUTH and regular user login?
- Janrain/Simple Modal under Redirected Domain
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine
- How to create repeater field manually, without plugin (ACF Pro)?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- Disable Author Archive just for certain roles in bulk
- WordPress Phone Field Check (use numbers, spaces and pluses)
- What snippet do I need to type to show my ACF field show up on my theme?
- Can export gallery but can’t import it Wp all import
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Table of contents (TOC) plugin is not showing header tag
- Best approach to make all tags searchable by the wordpress search function
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Create a pdf from the entries in DB
- Help with autofilling field
- Delete user meta but only if found in array
- how to find out which plugin disable custom field for post
- Get user edit functions in frontend for site admin
- Preset custom fields
- What database state changes happen after a post is manually “updated” with no changes?
- Register PODS Custom Field with WPGraphQL [closed]
- Can I add a unique code for each user based on the location?
- get_post_meta shortcode returns empty field
- Can we hide a certain user in WP?
- Changing the Default New User Notification Email
- custom fields not displaying on wordpress site
- How to add Mobile field in Registration form using Theme my login Plugin
- WordPress hide post from custom post-type on a single page
- How to implement data residency in my WordPress site
- Create multiple posts when a custom post is created
- how to create user profile pages and display them based on users roles
- Why Custom fields description is not working WordPress Version 5.4.2?
- Adding Custom Endpoint in WordPress Rest API
- Clean old users
- General Term for this form Field
- After reading 3 story by user ask for subscription popup
- How do I change the functionality of an image slider which is part of ACF?
- Make custom post types using ACF
- Problem Advanced Custom Fields PRO
- Comment restrictions Wodpress
- How to pass multiple custom fields as shortcode’s parameters
- Safely changing UserID’s, re-using deleted UserID’s and automatically using deleted userID’s instead of an increment
- Meta Key array building with multiple input values from fields
- On button click, redirect users to registration page instead of another page
- How do I run my custom function in my plugin when a wordpress user is deleted?
- Custom product page’s style for printing
- Custom plugin issue – Notice: Trying to get property of non-object in
- How can I store user preferences in WordPress and retreive them later?
- Simulate Update User button click
- If I am not writing a theme, how do I add custom fields to a user for a plugin
- Saving data only when payment is successful
- Create password protected page, no registration
- Update User Meta Via Ajax
- User Following System
- Autofill advanced custom field with user data
- Taxonomy question
- Storing data to database and user registration
- Modifying meta keys in User Meta Pro using user_meta_pre_user_register not working
- How to see in Edit Comments if comment is from User and her Roles
- How to get post that has non zero or greater than zero meta value
- How can I call functions from a custom plugin?
- Creating Nested custom fields
- Custom User Notice Upon Login
- Problem with conditional woocommerce custom checkout field
- Create Biographies
- How can I save cookies to members
- How to use get_user_by in plugin
- Paid Memberships Pro, Display User Limit
- WordPress doesn’t save a post revision when changing CMB2 custom fields
- Overwrite user role
- Do something with thumbnail image on post publish