php 删除联系表格7脚本和Stlyes

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 删除联系表格7脚本和Stlyes相关的知识,希望对你有一定的参考价值。

<?php 
//You can set the value of this constant in your wp-config.php like this:
define('WPCF7_LOAD_JS', false);

//Likewise, you can control the loading of the CSS stylesheet with WPCF7_LOAD_CSS. Contact Form 7 does not load the CSS stylesheet when the value of WPCF7_LOAD_CSS is false (default: true). You can set it in the wp-config.php like this:
define('WPCF7_LOAD_CSS', false);

//Or, you can also disable the loading of the JavaScript and CSS by adding a few lines of code into your theme’s functions.php file, like this:
add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );

// And then load it only where the form is used. 
// Note that wpcf7_enqueue_scripts() and wpcf7_enqueue_styles() must be called before wp_head() is called.
    if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
        wpcf7_enqueue_scripts();
    }
 
    if ( function_exists( 'wpcf7_enqueue_styles' ) ) {
        wpcf7_enqueue_styles();
    }
// source: https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/
?>

以上是关于php 删除联系表格7脚本和Stlyes的主要内容,如果未能解决你的问题,请参考以下文章

php 联系表格7删除autoformatting(wp-config.php)

php 从不需要它的页面中删除联系表单7脚本和css

php 取消注册联系表格7 CSS和JS

php 取消注册联系表单7脚本和样式表

php Wordpress:联系表格7,添加表格标签(短代码)当前网址示例

联系表格 7 插件电子邮件正文自动删除