Combine category AND custom taxonomy in permalink structure

What I ended up doing was setting up an endpoint for food, like so: global $wp_rewrite; $wp_rewrite->add_endpoint( ‘food’, EP_PERMALINK | EP_PAGES ); $wp_rewrite->flush_rules(); function printview_query_vars($vars) { array_push($vars, ‘food’); return $vars; } add_filter(‘query_vars’,’printview_query_vars’); Then I’d get a url like http://mysite/pagename/food/fruits/shelves/ and the wp_query would contain something like food=>fruits/shelves, which then i can parse myself into a … Read more

WordPress Permalinks 404 bug with “next” button

I fixed the problem by editing my .htaccess file. I replaced it with the following. # BEGIN WordPress <IfModule mod_rewrite.c> ErrorDocument 404 /index.php?error=404 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress

Custom permalink structure only saves with index.php inserted

When you include index.php/ at the start of your custom permalink structure you are telling WordPress to use PATHINFO permalinks. WordPress Codex – PATHINFO: “Almost_Pretty” It is possible you are using an IIS (Windows) server or that mod_rewrite is not working correctly. Permalinks without mod_rewrite The following plugin can help you determine if mod_rewrite is … Read more

Rewrite rule not passing variable

Try adding ‘source’ as an custom query var, rather than defining it as a rewrite tag. function wpse162627_add_query_vars( $query_vars ){ $query_vars[] = “source”; return $query_vars; } add_filter( ‘query_vars’, ‘wpse162627_add_query_vars’ ); function custom_url_source() { add_rewrite_rule( ‘^source/([^/]*)$’, ‘index.php?source=$matches[1]’, ‘top’ ); } add_action(‘init’, ‘custom_url_source’);

External PHP file & Pretty Permalink

I can’t say I’ve ever tried including wp-load.php directly, but I’ve had success using: define(“WP_USE_THEMES”, false); include(“wp-blog-header.php”); … when trying to invoke WordPress stack in a non-templated workflow. wp_blog_header.php does make the call out to wp-load.php but also wires up some other stuff (such as calling wp()).

How can I set up a secondary permalink structure?

I think I found a solution to this with a function that’s not commonly used: add_permastruct(). This does the trick of what I described above: add_rewrite_tag(‘%page%’,'([^/]+)’, ‘pagename=”); add_permastruct(“abc’,’/abc/%page%/’,false); add_rewrite_rule(‘abc/?$’,’index.php?page_id=6′,’top’); The add_rewrite_tag() defines the pagename value that I want WordPress to lookup. Then add_permastruct() defines my custom structure with that value. The last rule is just … Read more

Fix 404 error after changing permalink structure

If your .htaccess file were writable, wordpress do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. 1- Open .htaccess file and copy following data in that file. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . … Read more

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