akhilser
Forum Replies Created
Viewing 8 replies - 1 through 8 (of 8 total)
-
Forum: Fixing WordPress
In reply to: Custom Post Taxonomy Create a New tab like Name and descriptionthanks
Forum: Fixing WordPress
In reply to: Insert Custom Data to Custom post TaxonomySolved!!
Forum: Fixing WordPress
In reply to: Type Form Webhook API WordPressThanks
Forum: Fixing WordPress
In reply to: Image upload Via URL progromatically to Media LibraryThere sould be no form or any upload field . directly upload with function only
- This reply was modified 3 years, 7 months ago by akhilser.
Forum: Fixing WordPress
In reply to: Image upload Via URL progromatically to Media LibraryThanks. I already did the form submit method so im trying to upload through image url
if ( !function_exists('media_handle_upload') ) { require_once(ABSPATH . "wp-admin" . '/includes/image.php'); require_once(ABSPATH . "wp-admin" . '/includes/file.php'); require_once(ABSPATH . "wp-admin" . '/includes/media.php'); } $url = "https://www.w3schools.com/css/img_fjords.jpg"; $tmp = download_url( $url ); if( is_wp_error( $tmp ) ){ // download failed, handle error } $post_id = 0; // set 0 for no parent post id or simple attachment otherwise pass post id for include in post $desc = "The WordPress Logo"; $file_array = array(); // Set variables for storage // fix file filename for query strings preg_match('/[^\?]+\.(jpg|jpe|jpeg|gif|png)/i', $url, $matches); $file_array['name'] = basename($matches[0]); $file_array['tmp_name'] = $tmp; // If error storing temporarily, unlink if ( is_wp_error( $tmp ) ) { @unlink($file_array['tmp_name']); $file_array['tmp_name'] = ''; } // do the validation and storage stuff $id = media_handle_sideload( $file_array, $post_id, $desc ); // If error storing permanently, unlink if ( is_wp_error($id) ) { @unlink($file_array['tmp_name']); return $id; } $src = wp_get_attachment_url( $id );this is my code using this code each time i refresh the media library page the image creating multiple times.
Forum: Fixing WordPress
In reply to: Image upload Via URL progromatically to Media Libraryi would like to create the image only 1 time when there is new img url passed or something like that . Plugins are decrease optimization and speed so thats why im trying pure functions. Is there is any hooks available . Thanks for ur Help
Forum: Plugins
In reply to: [WooCommerce] Custom post View CountThanks
Forum: Plugins
In reply to: [WooCommerce] Add Shipping Fee to New ordersThanks for your replay @rynald0s issue Solved…
Viewing 8 replies - 1 through 8 (of 8 total)