PDF Embedder Documentation

Documentation, Reference Materials, and Tutorials for PDF Embedder

Can I write PHP code to change the shortcode parameters?

You can set most settings in the Settings -> PDF Embedder page in WordPress. These apply to all embeds by default, but you can override the settings of individual embeds by manually adding shortcode parameters to the individual pdf-embedder shortcodes – see details here.

It is also possible to override the global defaults by writing PHP code, using a filter named pdfemb_filter_shortcode_attrs.

For example, to add the pagetextbox option to every embed so you don’t have to add it to every shortcode manually (there is no global setting available for this parameter), you could add the following code to your Theme’s functions.php or similar:

add_filter('pdfemb_filter_shortcode_attrs', 'mypdfshortcodes', 10, 1);

function mypdfshortcodes($atts) {
   $atts['pagetextbox'] = 'on';
   return $atts;
}Code language: PHP (php)

You could inspect the value of $atts['url'] if you want to vary the attributes based on the specific PDF file being displayed.

Still have questions? We’re here to help!

Last Modified: