I had to dig pretty deep for this too, and eventually figured out some way to do this.
in my solution I used the following:
WP_Filesystem();
global $wp_filesystem;
$wp_filesystem->exists( '/path/to/file' ); //use any other functions available in the Filesystem API: @see https://developer.wordpress.org/reference/classes/wp_filesystem_direct/
Related Posts:
- Call to a member function put_contents() on a non-object
- Copy a file from a plugin into my theme directory
- How do you use unzip_file()?
- How to append_contents using WP_Filesystem?
- When to use the Filesystem API? Should I use it at all?
- Why my wordpress blog files are getting changed?
- Finding the path of a specific WordPress install
- How to include form for WP_Filesystem()?
- How does WordPress access theme and plugin files through its editor?
- Is there a way to use WP filesystem without credentials when FS_METHOD is NOT set to direct?
- unzip_file not working with the remote file
- How can I add a method to create files when in theme-editor.php
- How to Copy Upload Image using WP_Filesystem_Direct
- Add `manifest.json` file to a Custom WordPress Theme
- How to display dialog box to save file from wp_filesystem->put_contents function?
- using wp_remote_get instead of file_get_contents [duplicate]
- Creating directory in uploads – wp_mkdir_p() or WP_Filesystem?
- Standard location for plugin to save/cache files?
- How to use WordPress HTTP API to download file from remote location
- wp_remote_get(), downloading and saving files
- How to wp_upload_bits() to a sub-folder?
- rewrite script to use wp_remote_get instead of file_get_contents_curl
- HTTP request on localhost failing
- wp_remote_get vs. file_get_contents vs. cURL?
- wp_remote_get() not retrieving pages properly
- How to get the generated query string of wp_remote_get?
- Can’t access wp_filesystem in cron function
- What exactly does $wp_filesystem->abspath() return?
- wp_remote_get returns an error for valid URL
- What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?
- Allowing all/different file type uploads
- Moving wp-content outside of web root?
- How do I edit the php/html for a particular post?
- Setting wp_temp_dir and permissions not working for “Missing A Temporary Folder” error
- Use WP_Filesystem to list files in directory
- How do I execute a wp_remote_get call using NTLM authentication?
- Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?
- Trying to get an api request getting error 404
- Using wp_filesystem in Plugins to store customizer settings
- Where is Featured Image code stored in WP?
- how to change max file upload size WordPress 4.9.8 [closed]
- Downloading File from Outside Web Root
- What is the best way to move a plugin´s subdirectory+files to wp-content/uploads-directory?
- WP_Remote_Get Not working
- using wp_remote_get to retrieve own url on local host
- How to check if txt file exists inside template folder?
- wp_remote_get() and javascript/noscript situation
- Unable to check if image uploaded by wp_image_editor exists using file_exists function
- Is file_get_contents() the only way for plugins reading local files OR does WP_Filesystem_Direct::get_contents() even work?
- Where to write custom logs in WordPress
- wp_remote_get – curl error 28 connection timed out – using SANS in URL
- wp_filesystem put_contents issue with owner/group
- wp_remote_get times out on api request but jquery GET and postman work?
- wp_remote_get sslv3 alert handshake failure
- What dependencies should I load and to use the WP_Filesystem?
- Where would I put my call to wp_remote_get?
- Fetching data from another website results in a slow website?
- Errors on a single host using wp_remote_get() unless sslverify is set to false
- Running rmdir function on post save
- How to move core js files into the footer
- http_response_timeout filter not working
- @file_get_contents and wp_remote_get
- WordPress Creates Unused (Unregistered) Image Sizes
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- How to run wp_remote_get() inside of a loop for multiple page API response?
- WordPress HTTP API NTLM Authentication
- What functions of WP_Filesystem allow me to create a file with code-generated contents in a directory?
- Is there a name for trivial WP PHP files like functions.php, archive php entry.php, page.php and so forth?
- Right way to download file from source to destination
- Why WordPress not using WP_Filesystem
- wp_remote instead of file_get_contents on non json
- Wrapping add_query_arg with esc_url not working
- how get number of twitter followers in wordpress
- calling admin-ajax.php from admin-ajax.php
- Issues with downloading a file with wp_remote_get()
- How to write txt file?
- Need help creating asynchronous data scraper in WordPress
- Proxy External API request in PHP from Edit.js in Block Plugin
- How to prevent users to view server files using WP File Manager plugin?
- How can I create a WordPress dynamic download counter
- Admin Custom Plugin List Files in admin Table
- temphangle variable missing when using wp_filesystem copy
- how to get json file in wordpress template
- How to import the data to the post from an external URL?
- Unzip_file causing Media file upload error
- Daily automatic update of stock quotes via REST API and Cronjob. Or is there a more sophisticated way?
- Downloadable content file structure
- trying to locate the correct file to edit my internal linking anchor tags
- Why does unzip_file always return true but nothing happens?
- Should I use Filesystem API for reading files or listing directories?
- how to create or rewrite files in wordpress plugin folder
- Should I use transients for these API call results?
- wp_remote_get() never fires
- How to use wp_remote_get in place of file_get_contents?
- wp_remote_get with Google Books API
- Upgrading WordPress (File permission group owner)
- Problem getting wp posts in plugin with wp_remote_get
- How to use the HTTP API (wp_remote_get) instead of cURL?
- WordPress upload path decalration
- Does unzip_file() over-write by default?