我怎样才能改变ADD_ACTION( 'after_setup_theme', 'like_add_custom_post_types');这个钩子

问题描述 投票:1回答:1

在我的主题存在插件如何注册10个自定义后类型与ADD_ACTION(“after_setup_theme”,“like_add_custom_post_types”);我想改变它,registr只有2。

我尝试用remove_action删除此()和writh新的行动,但有错误,致命错误:不能重新声明like_add_custom_post_types()(以前在...(插件路径声明)//////这个插件代码

    function like_add_custom_post_types() {

        $cpt = array(

            'testimonials'  => true,
            'sliders'       => true,
            'sections'      => true,
            'events'        => true,
            'menu'          => true,
            'gallery'       => true,
            'team'          => true,
            'faq'           => true,
        );

        foreach ($cpt as $item => $enabled) {

            $cpt_include = likeGetLocalPath( '/post_types/' . $item . '/' . $item . '.php' );
            if ( $enabled AND file_exists( $cpt_include ) ) {

                include_once $cpt_include;
            }
        }   
    }
    add_action( 'after_setup_theme', 'like_add_custom_post_types' );


    function like_rewrite_flush() {
        like_add_custom_post_types();
        flush_rewrite_rules();
    }

  ///////// my code 
    add_action( 'after_setup_theme', 'remove_parent_theme_stuff', 0 );

    function remove_parent_theme_stuff() {

        remove_action( 'after_setup_theme', 'like_add_custom_post_types' );
    }

    add_action('after_setup_theme',"like_add_custom_post_types");


    function like_add_custom_post_types() {





                include_once ABSPATH.'/wp-content/plugins/like-themes-plugins/post_types/sections/sections.php';


    }
    add_action( 'after_setup_theme', 'like_add_custom_post_types' );
php wordpress wordpress-theming action
1个回答
0
投票

在主题叫like_add_custom_post_types搜索功能。由于错误地说名字like_add_custom_post_types功能已经在主题。

怎么解决 :

  • 更改函数名称别的东西。
  • 如果要删除后第8类,然后发现功能和评论register_post_type ADD_ACTION( 'after_setup_theme', 'like_add_custom_post_types');
© www.soinside.com 2019 - 2024. All rights reserved.