AnsPress_Tag::register_question_tag()

Description #

Register tag taxonomy for question cpt.

Changelog #

VersionDescription
2.0Introduced.

Source #

File: addons/free/tag.php

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
public static function register_question_tag() {
    ap_add_default_options([
        'max_tags'        => 5,
        'min_tags'        => 1,
        'tags_per_page'   => 20,
        'tag_page_slug'   => 'tag',
    ]);
 
    $tag_labels = array(
        'name'                      => __( 'Question Tags', 'anspress-question-answer' ),
        'singular_name'         => _x( 'Tag', 'anspress-question-answer' ),
        'all_items'               => __( 'All Tags', 'anspress-question-answer' ),
        'add_new_item'          => _x( 'Add New Tag', 'anspress-question-answer' ),
        'edit_item'               => __( 'Edit Tag', 'anspress-question-answer' ),
        'new_item'                => __( 'New Tag', 'anspress-question-answer' ),
        'view_item'               => __( 'View Tag', 'anspress-question-answer' ),
        'search_items'          => __( 'Search Tag', 'anspress-question-answer' ),
        'not_found'               => __( 'Nothing Found', 'anspress-question-answer' ),
        'not_found_in_trash'  => __( 'Nothing found in Trash', 'anspress-question-answer' ),
        'parent_item_colon'   => '',
    );
 
    /**
     * FILTER: ap_question_tag_labels
     * Filter ic called before registering question_tag taxonomy
     */
    $tag_labels = apply_filters( 'ap_question_tag_labels'$tag_labels );
    $tag_args = array(
        'hierarchical' => true,
        'labels'       => $tag_labels,
        'rewrite'      => false,
    );
 
    /**
     * FILTER: ap_question_tag_args
     * Filter ic called before registering question_tag taxonomy
     */
    $tag_args = apply_filters( 'ap_question_tag_args'$tag_args );
 
    /**
     * Now let WordPress know about our taxonomy
     */
    register_taxonomy( 'question_tag', array( 'question' ), $tag_args );
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment