Skip to main content

gfpdf_mpdf_tmp_location

Description​

By default the mPDF temporary files are stored in a folder called mpdf inside the Gravity PDF temporary directory. This filter allows you to change this directory independent of where the Gravity PDF temporary directory is.

warning

A shared folder like get_temp_dir() lets other websites on the server share the mPDF cache. Ensure you set a directory only used by your website.

Parameters​

$path | string​

  • The path to the tmp folder.

Usage​

The following snippet shows you how you can move the directory to a different location:

add_filter( 'gfpdf_mpdf_tmp_location', function( $path ) {
return get_temp_dir() . 'gravity-pdf-' . wp_parse_url( home_url(), PHP_URL_HOST );
}, 10 );

Once you've verified the filter works correctly, you should manually remove the old directory.

Source Code​

This filter is located in the Model_Install::setup_template_location() method of /src/model/Model_Install.php.