Add pdf to a website

Your website speed totally depends on your server speed. If you have a lot of visitors that are going to open/use those PDF links, then you are going to have a large number of requests, of course. This might result in a slower speed on a shared hosting. The better way is to use a … Read more

Location of image metadata on my server

The image url is store in wp_posts as an attachment post_type with their corresponding posts(s) as parents. From Codex, see Template Tags Show All Attachments I believe something like this would retrieve all attachments in DB outside of a loop: global $post; $args = array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘post_parent’ … Read more

wp_upload_bits() is not giving the file path right in localhost

I ran into the same exact issue (getting paths like ‘X:xampphtdocswordpress/wp-content/uploads/2017/05/filename.jpg’ on WAMP on Windows). The issue seems to be due to update_post_meta() passing values through stripslashes() when storing the data. The workaround is to add wp_slash() around your value you pass to update_post_meta(). You’re probably calling update_post_meta() something like this: update_post_meta( $id, ‘doesnt_work’, $data … Read more

Resize uploaded original images to a minimum automatically

From purely WordPress point of view you want add_image_size() with a “hard” crop mode. That will ensure that any significantly large image will be sized to fit into those dimensions exactly, cropping some parts if necessary. The problem is usually that WP won’t upsize small images to fit, as far as I remember. It is … Read more

Front-End User Profile

UPDATE: As mentioned in the comments, you might want to learn how you do things like create meta boxes and do a file upload in WordPress without using a framework like CMB2 first. However, as a seasoned WordPress developer, I have found that using CMB2 greatly increased my productivity. I highly recommend using CMB2 to … Read more