rewrite rule generated with mpdf to a shorter version
ok it was easy, the problem was that to match the left side pattern you have to use $1 not $matches[1], this is the solution /** * Rewrite rules */ add_action( ‘init’, function() { add_rewrite_rule( ‘^invoice_([0-9]+).pdf$’, ‘/wp-content/themes/mysitetheme/invoices/invoice_$1.pdf’, ‘top’ ); } ); UPDATE From the suggestions received in the comments, it is now clear to me … Read more