Kategorien
Development WWW

Contact Form 7 – Scripts, styles and reCaptcha only on certain pages

Many people are using the WordPress Plugin „Contact Form 7“ for displaying and managing their contact forms. The plugin is definitely a musthave if you have no idea, how to integrate a contact form into your WordPress blog. As a contact form is one of the many used ways to flood your inbox with spam mails, the plugin also integrates the Google reCaptcha Service to prevent you from being bombed by spam mails. The plugin author changed the integration to version 3 some time ago which lead to the problem, that the little reCaptcha overlay is displayed on every page of your blog. Some people will find that okay but in my opinion, this should be fixed. After I did some research in the plugin’s forum on wordpress.org I found some working solutions, but there was always something missing. Either the CSS styles were loaded on every page or you had to define the ids of the pages, on which the assets of the plugin had to be loaded.