Bugs, Bugs and more Bugs Fixed in Gravity PDF 4.0.6

Gravity PDF 4.0.6 Now Available

We fixed a bunch of edge-case bugs in this release, making Gravity PDF even more stable. The most notable changes include additional modifications to support Almost Pretty Permalinks (the ones with index.php in the URL), allowing mergtags to be saved in HTML attributes in Headers / Footers and a fix to the page numbering for Mpdf’s Table of Contents element.

This update is now available via one-click updates in your WordPress admin area and through WordPress.org.

For the best experience we recommend you keep WordPress, your plugins and PHP updated.


  • Correctly register our PDF link with the WP Rewrite API when “Almost Pretty” permalinks are active (GH#502)
  • Correctly process mergetags in password field for Tier 2 PDF templates (GH#503)
  • Allow mergetags to be saved in HTML attributes in our Header / Footer settings – DEV NOTE: all Rich Text Editor settings fields should be output with wp_kses_post( $html ) (GH#492)
  • Process mergetags before Header / Footer settings get passed to wp_kses_post() on output (GH#512)
  • Renamed check_wordpress() method to is_compatible_wordpress_version() to prevent false positive using ConfigServer eXploit Scanner (GH#500)
  • Explicitly set a forward slash after the home_url() when building PDF links (GH#511)
  • Resolve incorrect page numbering in Mpdf’s Table of Contents
  • Change Helper_Misc->get_contrast() to choose white in more cases (GH#506)

Developer Notes

  • We no longer sanitise the Rich Text Editor content on input. If using a Rich Text Editor field as a custom PDF template option you need to sanitise the field on output by using wp_kses_post( $html );
  • The method Helper_Misc->get_contrast() favours white over black in more cases. If using this method, verify your PDF templates don’t have any contrasting issues.
  • If calling GFPDF_Major_Compatibility_Checks->check_wordpress() directly update your code to use GFPDF_Major_Compatibility_Checks-> is_compatible_wordpress_version() instead.