Masking wp-content/themes/name/images to just images directory using htaccess

Check out the Roots WordPress Theme. They seem to do exactly what you want with the URLs. Here’s a snippet from their roots-htaccess.php file: add_action( ‘generate_rewrite_rules’, ‘roots_add_rewrites’ ); function roots_add_rewrites($content) { $theme_name = next( explode( ‘/themes/’, get_stylesheet_directory() ) ); global $wp_rewrite; $roots_new_non_wp_rules = array( ‘css/(.*)’ => ‘wp-content/themes/’ . $theme_name . ‘/css/$1’, ‘js/(.*)’ => ‘wp-content/themes/’ . … Read more

Change author base slug for different roles

In your example, the author rewrite pattern changes from /author/[authorname]/ to /[author_level]/[author_name]/. If we allow [author_level] to be anything, we will get into conflict with the rules for pages, because /[anything]/[anything]/ can be either an author archive or a regular subpage. For this reason, my solution assumes you have a limited number of author levels, … Read more

Rewrite Slug for CPT Archive Pages to Plural Name of Slug

When you register the post type, set the argument ‘has_archive’ to a string, in your case plugins. The doc block for register_post_type() says: @type bool|string $has_archive Whether there should be post type archives, or if a string, the archive slug to use. Will generate the proper rewrite rules if $rewrite is enabled. Default false. Minified … Read more

web.config conflict on IIS

I don’t have the reputation to comment so I’m sure this may be dumped if not totally complete/accurate; but, doesn’t WP work in a way that it goes through the core’s index.php file using rewrites and such. This being the case, if you don’t specify a specific file that you are accessing, you aren’t really … Read more

Understanding add_rewrite_rule

A basic rule that would work for your example: function wpd_foo_rewrite_rule() { add_rewrite_rule( ‘^foo/([^/]*)/?’, ‘index.php?pagename=$matches[1]&param=foo’, ‘top’ ); } add_action( ‘init’, ‘wpd_foo_rewrite_rule’ ); This takes whatever comes after foo/ and sets that as pagename for the query, and then param gets the static value foo. If you need different URL patterns, you’ll need extra rules for … Read more

Use a template file for a specific url without creating a page

You can just look at url, load the file and exit. That can be done when WordPress loaded its environment, e.g. on ‘init’. add_action(‘init’, function() { $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), “https://wordpress.stackexchange.com/”); if ( $url_path === ‘retail’ ) { // load the file if exists $load = locate_template(‘template-retail.php’, true); if ($load) { exit(); // just exit … Read more

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