mehrshaddarzi
10/25/2018 - 4:13 AM

apply filters

apply filters

<?php

//Example 1
function create_reviews_post_type() {
    $slug = apply_filters('plugin_cpt_slug','reviews');
    $name = apply_filters('plugin_cpt_name','Reviews');
    $sname = apply_filters('plugin_cpt_name_singular','Review');

    register_post_type($slug, array(
        'labels' => array(
            'name' => __($name),
            'singular_name' => __($sname)
            ),
        'public' => true,
        'has_archive' => true,
        )
    );
}
add_action('init', 'create_reviews_post_type');

add_filter('plugin_cpt_slug','change_plugin_cpt_slug');
function change_plugin_cpt_slug(){
    return 'complaints';
}