Reading a file to send to the user is perfectly safe and does not necessarily need to be converted to the WP_Filesystem methods. Only writing is potentially an issue.
However, if you wanted to do so, this would be the equivalent:
echo $wp_filesystem->get_contents( filename variable here );
Also, note that your filename for “put_contents” is incorrect. Instead of using WP_PLUGIN_DIR
, you need to use $wp_filesystem->wp_plugins_dir()
because the “remote” directory might not be the same as the “local” directory.
$mySettingsFileLocation = $wp_filesystem->wp_plugins_dir() . '/my-settings/settings.ini';
Related Posts:
- How to fix the error “file_get_contents was found in the file functions.php”?
- Creating directory and file using native wordpress file system
- Unable to check if image uploaded by wp_image_editor exists using file_exists function
- WordPress API Menu/Submenu Order
- What WP folder can I use to write files to?
- Form Submitting Error with get_template_part()
- Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere
- Can’t get staging site to display same way as live site. Completely stumped
- How to add default images for custom backgrounds?
- How to call the_excerpt() with tags or the_content() as an excerpt?
- Display a different theme for not logged-in users
- how to test a theme upgrade
- Best practice (forward compatibility) for theme options
- How to set path with WP_Filesystem and ftp base / chroot
- How to add paging to query
- what’s meaning of it when submit a theme?
- How to Modify a Widgets UL and/or LI Classes
- How to remove menus section from WordPress theme customizer
- Returning Variables back into a template
- Getting Permalink within the loop
- Allow users to add custom functions to wordpress theme
- How to add custom template tag in wordpress theme?
- Doubled titles when using All in One SEO with custom template
- What page should I use for a contact form?
- Get attachments by user
- How do I locally enqeue the mediaelement.js file into a wordpress theme
- Version control for both Vagrant config and themes being developed [closed]
- Theme change only in CSS and a few images
- wp_editor() usage in custom meta box
- Is there an action for save_menu and/or update_menu?
- Does a premium / for sale theme need to go through the WordPress approval process?
- Metadata Query when storing data as array possible?
- Excluding Pages not working
- filter out “uncategorized” from all category listings with one filter in functions.php?
- How to use different assets if local or live
- get_option() returning empty
- How can I add a custom button to the post editor toolbar?
- How to make the excerpt_more filter apply to the actual post excerpt?
- How to add a user defined hyperlink to the “Featured Image” and the_post_thumbnail()
- Using PIE CSS in WordPress. “localizing” styles
- Category specific themes?
- Default image size not working
- Change locale by detecting viewer’s browser language setting and let them choose prefered language after
- Why is it needed to enqueue parent stylesheet in child theme?
- Limit number of users a role can create
- Changing Header Image Every N Minutes/Seconds
- Do not display post images on front page
- Change WordPress header color using customizer
- Default Text not showing from customizer
- underscores use of the article element on the page template
- Ideal inline dynamic CSS injection
- How to create and populate with few links a menu in child theme functions.php?
- Plugin does not work in custom theme
- How to Manually Code Shortcode?
- How to show a manageable list of images on a post?
- Making custom woo themes
- Where does the uploaded image go?
- Remove link on full-size images
- How to reset post data properly
- Theme options save routine clashes with plugin save
- Previous and Next links not populating, have I missed something?
- get_search_query() not working with search queries with ampersand in it
- Single.php the_excerpt loads same as the_content not loading read more line
- Where to put custom page templates in theme?
- If user is logged in and has a role echo statement
- How to fix WordPress images not showing up in local hosted XAMPP server?
- Let user to add input fields on theme option page
- .current_page_ancestor broken in Twenty Eleven
- MapPress Easy Google Map in Jquery Tabs Problem
- Homepage slider not using correct images
- WordPress Show Single Post on Home Page with previous/ Next Button
- How to change listing type permlink?
- WordPress theme header.php should I add title meta?
- Problems with cart and pages on _s theme
- Creating a Single Page Theme correctly
- Custom post type query with pagination doesn’t work
- Fatal error: Class WP_Customize_Image_Control not found
- Edit Product Archive design for Woo theme
- How do I remove header/page-title image in farvis theme? [closed]
- Which theme PHP file should be edited in order to change Posts appearance
- Necessary css classes to be included in theme stylesheet
- How to link post image to post link?
- How to hide blog by id wordpress multisite listing
- Get chronological page order
- Query wp_postmeta into an array based on post_id
- Including some variables in function.php and echo them is several place of theme is not working
- How to override wordpress native options with theme options
- Problem with multiple menus in theme
- How to create multiple sidebar areas with a forloop and register_sidebars?
- How to convert that page to a wordpress template? [closed]
- Saving Permalinks Results in 403 MAMP (Windows)
- Add rel to all images in a post
- WordPress theme Modifications not showing up on live server
- Bootstrap isn’t called into my WordPress theme
- Adding a new layout for genesis
- Which function(s) to build a paged HTML table
- white spaces on the all sides [closed]
- Creating image grid on products page in wordpress
- Insert gutenberg blocks into template
- How to make it so I can “use” template parts in (classic/full) site editor