Find files which starts with empty lines or whitespaces / WordPress empty lines in source / MailPoet Captcha not working / Linux Cli

| | Allgemein

I had the Problem that the MailPoet Captcha was not working any more. Quick research lead me to the fact that this comes from whitespaces or empty lines before <?php tags.

I have searched them on the console with this command:

find . -type f -exec perl -0777 -ne ‚print „$ARGV\n“ if /^(\W)+<\?php/‘ {} +

Mostly these are located in functions.php of the template or in plugins, in my case it was a WP_CLI Command.

Dateien mit Leerzeichen oder Umbrüchen in den ersten Zeilen finden / Linux Konsole

Ich hatte das Problem, dass das MailPoet Captcha nicht mehr funktionierte. Eine schnelle Recherche führte mich zu der Tatsache, dass dies von Leerzeichen oder Leerzeilen vor <?php Tags kommt.

Ich habe sie in der Konsole mit diesem Befehl gesucht:

find . -type f -exec perl -0777 -ne ‚print „$ARGV\n“ if /^(\W)+<\?php/‘ {} +

Meistens befinden sich diese in functions.php des Templates oder in Plugins – in meinem Falle war es in einer Datei mit einem WP_CLI Command.