How to change custom post type slug

You can use register_post_type_args to modify slug of any custom post type. You need to change portfolio slug to work? Then code should be like this. add_filter( ‘register_post_type_args’, ‘change_slug_portfolio_to_work’, 10, 2 ); function change_slug_portfolio_to_work( $args, $post_type ) { if ( $post_type == ‘portfolio’) { $args[‘rewrite’][‘slug’] = ‘work’; } return $args; }

Custom rewrite after the default term link URL

(Revised answer) So Let’s See The Issues With Your Rewrite Rule.. The first parameter passed to add_rewrite_rule() (which is the regular expression pattern) should not start with home_url() or any functions which outputs the website URL. So this is wrong: home_url() . ‘/car/([^/]*)/([^/]*)/?’ because the generated regular expression (RegEx) pattern would be: http://example.com/car/([^/]*)/([^/]*)/? which will … Read more

How to add custom rewrite rules and point to specific templates

You need to create query_var for sector and you need to create a rewrite rule with RegEX. I created a plugin for this. Create a file and add into the wp-content/plugins folder and activate it. <?php /* Plugin Name: Custom Rewrite Plugin URI: https://serkanalgur.com.tr Description: Custom Rewrite Version: 1 Author: Serkan Algur Author URI: https://www.serkanalgur.com.tr … Read more

Is it possible to create dynamic endpoint URLs?

add_rewrite_endpoint() only supports static endpoint names like trackback and recipes, so if you need a dynamic endpoint name/slug, then you would want to use add_rewrite_rule() instead. And just so that you know, even if add_rewrite_endpoint() did support dynamic names/slugs, your code would not work because your function runs too early (via the init hook) and … Read more

Custom Download Link

Do you just need to redirect that one specific request (for /wp-content/uploads/2010/12/history.pdf to /about/history.pdf)? Or do you need to to handle many requests (say, for /wp-content/uploads/2010/12/* to /about/*)? If it’s the former, use a symbolic link (or, if you’re not on Unix/Linux/BSD, whatever equivalent your OS offers). If it’s the latter, use mod_rewrite (or, if … Read more

Rewrite vs Redirect from ?p={ID}

A rewrite enables http://example.com/post-title/ to translate internally to the proper query vars to load the requested post. The shortlink does a 301 redirect to the pretty URL because it should not be possible to access the same content from more than one URI. This is so a search engine won’t index the same post under … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)