Can’t understand how to use add_rewrite_rule [closed]

Part 1 Ans:
I am presuming you have added the custom post type yourself, in which case it is easy.

When you register a new post type, you can set any rewrite rules for that post type to follow as part of the arguments used in the register_post_type( ‘name’, $args ) function.

If your post type is available on the front end and is public, then by default WordPress will use the custom post name as the slug. You can override this as follows:

$args = array(
    // your other arguments
    'rewrite' => array( 
        'slug' => 'products', // use this slug instead of post type name
        'with_front' => FALSE // if you have a permalink base such as /blog/ then setting this to false ensures your custom post type permalink structure will be /products/ instead of /blog/products/
    ),
);

register_post_type( 'portfolio', $args );

The other arguments you can use are documented at http://codex.wordpress.org/Function_Reference/register_post_type

Part 2 Ans:
For achieving below

sitename.com/catalog/random-subcategory/
sitename.com/catalog/random-subcategory/random-item
sitename.com/catalog/random-subcategory/random-sub-subcategory/random-item
to
sitename.com/random-subcategory/
sitename.com/random-subcategory/random-item
sitename.com/random-subcategory/random-sub-subcategory/random-item

If you want to remove /catalog/ from the url, follow these two steps:

Go to Settings >> Permalinks and select Custom and enter: /%category%/%postname%/
Next set your Category Base to .
Save it and you’ll see your URL changed to this format: sitename.com/random-subcategory/

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedueduseduseduedusedueduedusedus