Dynamic function name in php

后端 未结 6 1056
悲&欢浪女
悲&欢浪女 2021-01-04 16:16

I would like to simplify the creation of \"Custom Post Types\" in WordPress as it is tedious to go through the same script and change all the custom post type name instances

6条回答
  •  轮回少年
    2021-01-04 17:11

    This is an old thread but simply use anonymous functions:

    add_action('init', function() use($args) {
        //...
    });
    

    Then there is no need to declare so many functions.

提交回复
热议问题