Passing variable as permalink URL
When using the pagename query var with a parent/child page, the value should reflect the parent/child relationship, or it will cause a redirect. Instead of: pagename=profile try: pagename=faculty/profile
When using the pagename query var with a parent/child page, the value should reflect the parent/child relationship, or it will cause a redirect. Instead of: pagename=profile try: pagename=faculty/profile
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
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
This is a Site I maintain hosted on GoDaddy. All HTML seen by the outside world is stored in the /public_html directory. Therefore /public_html is considered the root directory of my server. This site runs on WordPress 3.9.1. All that was done, was that GoDady’s custom installer package unzipped the WordPress download zip to the … Read more
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
Changed the wordpress address and siteurl in Dashboard > Settings > General
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’);
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()).
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
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