WP-Optimize
95Get caching and more with this powerful cache plugin. Cache, optimize images, clean your database and minify f...
A safe and reliable WordPress shortcode for PHP's file_get_contents() function.
The JSM file_get_contents() Shortcode is a WordPress plugin that allows you to use a shortcode to safely retrieve and display content from local files or external URLs. It provides various attributes to control how the content is processed and displayed, such as caching options and HTML escaping.
This plugin is suitable for users who need to include content from files or URLs in their WordPress site without compromising security. It is particularly useful for developers who want to manage content dynamically while ensuring safe access to file paths.
Best for: This plugin suits WordPress developers and site owners needing to include dynamic content from files or URLs.
What it does well
Where it falls short
The JSM file_get_contents() Shortcode offers a straightforward solution for including file content in WordPress, with a focus on security and customisation. It may be beneficial for those comfortable with using shortcodes and managing file paths.
JS Morisset's own description of JSM file_get_contents() Shortcode, lightly tidied.
A safe and reliable WordPress shortcode for PHP’s file_get_contents() function.
container (default is false). container, and add a language class to the ‘code’ container (default is none). container (default is false). container (default is false). container, and add a language class to the ‘pre’ container (default is none).Note that all file paths (not URLs) are relative to the wp-content/ folder. For security reasons, it is not possible to include files outside the wp-content/ folder. As an example, the shortcode attributes
url="file://dir/file.html"andfile="/dir/file.html"are both read as wordpress/wp-contents/dir/file.html. The..folder name is also stripped from file paths to prevent backing out of the wp-content/ folder.
The WPFGC_SHORTCODE_NAME constant can be defined in your wp-config.php file to add an additional custom shortcode name (the default shortcode names are ‘wp-file-get-contents’ and ‘wpfgc’).
define( 'WPFGC_SHORTCODE_NAME', 'include' );
[wpfgc url="http://example.com/dir/file.html"]
[wpfgc url="http://example.com/counter/" cache="7200"]
[wpfgc url="file://dir/file.html"]
[wpfgc file="/dir/file.txt" pre="true" filter="my_custom_filter_name" cache="600"]
[wpfgc file="examples/example-1.php" code_lang="php"]
Other plugins for making sites fast.
Get caching and more with this powerful cache plugin. Cache, optimize images, clean your database and minify f...
All-in-one unbeatable acceleration & PageSpeed improvement: caching, image/CSS/JS optimization...
Comprehensive image optimization with WebP, AVIF, Lazy Load, and more. Optimize images automatically for Faste...
Easy to use Under Construction Page & Coming Soon Page. Enable Under Construction Mode in seconds & sh...
Compress and optimize images, enable lazy load, serve WebP & AVIF, and speed up your site with a global im...
Speed up your website by using our WebP & AVIF Converter. Optimize images and serve WebP and AVIF images i...