New answers tagged

1

You need to use Open Graph meta markup to have this type of sharing on Facebook .There are so many plugins available in the WordPress repository for this. For example: <meta property="og:url" content="http://sharing/url" /> <meta property="og:type" content="article" /> <meta property="og:title" content="Title of the post" /> <meta ...


-1

The default image sizes of WordPress are “thumbnail”, “medium”, “large” and “full” (the size of the image you uploaded). These image sizes can be configured in the WordPress Administration Media panel under Settings > Media. This is how you can use these default sizes with the_post_thumbnail(): the_post_thumbnail(); // without parameter ...


-4

Here give full url of your file where it is located. unlink(public_path('file/to/delete')) as you are just providing file name in your code @unlink($author_profile_photo["file"]); and with if you want to prevent generating an error if the file does not exist.


1

Thanks to @Tim Malone, @Kane Uploads are handled in the wp-admin directory, so try placing it in there. I've had success with placing php.ini files in there on shared hosts. – Tim Malone 1 hour ago Just place .user.ini to /wp-admin to overwrite the setting.


0

Unfortunately this isn't straight forward on Wordpress - you basically need to do a find/replace on the database to be sure you capture all of the uses of the old domain name and replace them with the new one. The old domain name may be used in references to uploaded files within posts, as well as in links within posts, and as you found and resolved ...


1

Unfortunately @Patrick's answer breaks the srcset functions introduced in WP 4.4. Fortunately, we just need to add two additional functions! First, we need to temporarily re-introduce all of the registered thumbnail sizes to the image metadata so they can be considered: function bi_wp_calculate_image_srcset_meta($image_meta, $size_array, $image_src, ...


1

You can use media_sideload_image() which will take a link to a file and upload it to the media library. You do need to pass it some kind of $post_id @Sumit points out in the comments you could pass NULL into the $post_id field. media_sideload_image( $file_url, $post_id, $image_desc, $return ); If you need the uploaded image ID, take a look ...


1

There are three ways you could do this: 1. Upload all into the Media Library The most tiresome way, IMHO, is to upload all the images you got via the media library. 2. Use a plugin You can use plugins like Add From Server to import your images easily to the Media Library 3. WP-CLI Easiest way once you got WP-CLI installed. Run wp media import to import ...


0

Can't seem to track down the right filter to process this in just yet (where the edit form is being saved), especially since attachment_fields_to_edit can be used in multiple places. But maybe you already know? This will give you a good start anyway... add_filter('??attachment_fields_save_filter??','move_attachment_directory',10,2); function ...


0

First you need to include thickbox into your theme to use tb_show popup function include_thickbox_scripts() { // include the javascript wp_enqueue_script('thickbox', null, array('jquery')); // include the thickbox styles wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0'); } ...


0

The link you provided deals with restricted access based on user permissions. But I gather from your question that you want to block hotlinking as a whole. If you don't already have one, you should create a .htaccess file in your root Wordpress directory (same location as wp-config.php). Add the following to it: # WP writes the following block # BEGIN ...


0

If you just want to hide it from standard search engines (stop indexing) then one way I know is to use YOAST SEO plugin. Once you install and activate the plugin, go to the Edit Media page which you do not want to appear in search engine results, and update Meta Robots Index to noindex and Meta Robots Follow to nofollow. Please check screenshot below: ...


0

Also happened to me, because of mod_expires.c The rules were causing the 404, but the files were OK on FTP: ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/gif "access 1 week" ExpiresByType image/jpg "access 1 week" ExpiresByType image/jpeg "access 1 week" ExpiresByType image/png "access 1 week" </IfModule> ...


1

Part 1: Form Handling Firstly, lets fix your upload form handling. You should never send the user to a dedicated PHP file for processing, wether it's a form or an upload because: The file then has to bootstrap WordPress to use the WP API, tightly coupling it to your folder structure, and introducing fragility The file will work even if the plugin has been ...


0

Maybe your switching from https to http after login, you can try this plugin https://wordpress.org/plugins/https-redirection/ to redirect all your site to https, I used it once and also changed my site URL from http://... to https://.... in wodpress settings. I see that you can simplify your code in these lines: else { $redirect_to = ...


0

In /wp-content/themes/centric-pro/style.css, delete line 88 through line 113 this removes all the font-face declarations. On line 88 paste the following: @font-face { font-family: 'GothamRounded-Bold'; font-style: normal; font-weight: 400; src: url('fonts/GothamRounded-Bold.eot') format('embedded-opentype'), ...


3

I'm copying a previous answer here as I think it will help. What this will do is whenever the media library pops up, instead of showing all media for a given post it will filter down to only images attached to the post. You could paste this right into your functions file: /** * Media Module - Only Show Images Uploaded To this Post */ function ...


0

HTML Okay, you'll of course want to set up an HTML file. I would use this code or something like it: <form action="upload.php" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form> ...


0

I think it depends on how you're handling the file input field in your form. I've used wp_upload_bits() in a plugin with a custom post type that has file attachments. The file is attached and uploaded using a metabox for the CPT and wp_upload_bits is called in the 'save_file_function' function called with add_action( 'save_post', 'save_file_function' ); This ...



Top 50 recent answers are included