I want assigned a value to my posts what variable by the current post’s id. Originally I want use custom post_meta for this, I think this is would been elegant, but when I run a query with this post_meta, my pageload will be horrible slow (4x-5x the basic time), because the sql query (I create an own index in my database for this post_meta, but this dont help for me)…

So, I read that, If I create a custom taxonomy, what have the same values, this will be fast, like tag queries. But I dont want that, if this custom taxonomy creates pages (domain(.)tld/taxonomy_name/taxonomy_slug)…

Can I create custom taxonomy without pages? So that this going to works like that a post_meta? Only a value, what queried?

2 Answers
2

It depends on what exactly you want, but you can play with public, publicly_queryable and other arguments when registering the taxonomy.

For example, with the following code, the taxonomy will have the user interface in the backend, but won’t be public and WordPress won’t generate a URL for each term:

add_action( 'init', 'register_custom_tax' );
function register_custom_tax() {
    register_taxonomy(
        'my-tax',
        'post',
        array(
            'public'  => false,
            'show_ui' => true
        )
    );
}

Leave a Reply

Your email address will not be published. Required fields are marked *