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

How can I add a custom permalink to a term?

I’ve done something similar to what you are after here, but I was simply filtering by a meta key. add_action(‘init’, ‘add_custom_meta_url’); function add_custom_meta_url() { global $wp,$wp_rewrite; $wp->add_query_var(‘food’); $wp_rewrite->add_rule(‘food/([^/]+)’,’index.php?food=$matches[1]’,’top’); $wp_rewrite->flush_rules(false); // This should really be done in a plugin activation } And then apply this to the index query through query vars (you’d have to target … Read more

Creating a Category Taxonomy

I would really suggest using one custom post type and one custom taxonomy with terms under the custom taxonomy which is assigned to a show. This structure will function exactly like normal posts with normal categories, the only difference is that it will be outside the scope of default blogging as custom post types are … 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

Big arabic permalinks not work

It depends on what encoding you are using. If you look at the database structure of wp_posts, you will see that post_name field is varchar(200) So, at most it can store 200 bytes of data. If you are using UTF-16 encoding, it needs 4 bytes to store an Arabic character. So, at most it can … Read more

Pagination url for page template

Below code will fetch all posts from all categories. Here we have given limit for one page as 10. Then you have to check the permalink structure of ur site. Please check the code I think it will work. /* it will fetch all posts */ $post_args = array( ‘posts_per_page’ => -1, ‘orderby’ => ‘post_date’, … Read more