Are you passing the full path to file_get_contents()?
If you have the file ID you can call get_attached_file() to get the path. Otherwise if you have the URL or filename you might be able to grab the ID by searching the posts table guid field.
Hi both, so basically I am writing an uploaded image into the media folder, but need to read the contents of the uploaded file. Im passing the url into it, the url exists, but its returning false. I dont have the ID of the file @Howdy_McGee
You also might try this to get the attachment ID via attachment_url_to_postid(). Once your have the actual attachment ID you can pretty much do whatever you want with it.
just remember, if you want to use any of the WP image APIs you're going to need an attachment post. If you're just handling an upload by writing the file to a folder in wp-content/uploads then none of that is available to you
Hey guys, is there a hook to change the word "by" before the post meta author name? Idk why I can't find it. Just want to remove it all together, instead of "By Timothy Fisher" just "Timothy Fisher".
@TimothyFisher This is likely a baked in theme feature. Presuming it uses the_author() function, the only hook is the_author filter but there's no "by" given.
I imagine you'll have to open the theme in a preferred editor an grep the files for it.
@Howdy_McGee Yeah you're right. I was using the Divi Builder and their blog module doesn't have a hook to customize it so I had to hook in and str_replace it because it wasn't wrapped in any sort of tag. Thank you!