Tag Info

Hot answers tagged

4

You don't need to add anything special to the top of 404.php. WordPress will know to use 404.php automatically when it tries to get a post or page and fails. To create a custom 404 page for a theme, the simplest way is to: Copy the index.php file from the current theme to a file called 404.php. Edit your new 404.php to delete the code dealing with ...


3

Without testing, I'll guess this has nothing to do with the author names specifically, but the fact that author is a built in WordPress query var, and /author/author-name/ is the default permalink for author archives. Change your post type name so the query var no longer clashes, then either change your post type rewrite slug, or change the the default slug ...


3

You should definitely avoid the public WordPress query vars: attachment attachment_id author author_name cat category_name comments_popup day error feed hour hour m minute monthnum name p page_id paged pagename post_parent post_type preview second static subpost subpost_id tag tag_id tb w year There's also this list of reserved terms, inexplicably located ...


3

Headers are sent long before you try to alter them. Headers are sent by actions associated with get_header(), so by the time your code executes, it is too late to alter the headers. You can demonstrate this with a simple experiment. Try each of the following: get_header(); status_header( 404 ); and status_header( 404 ); get_header(); In a template ...


3

This is challenging, because showing something would require page not to be private. It is more common to leave page public, but make it produce conditional output depending on if user is logged (is_user_logged_in()) in or other criteria.


3

Creating a secondary query or overwriting the main query inside a page template is the quickest and easiest way I know to break pagination. The main query, which determines which page to load runs before your template thus the results on the page and the query that loads the page become out of sync. The main query does not know about your in-template ...


2

All your inner links use the wwww subdomain instead of the www subdomain. Check your General Settings to see if you added an extra w in your site url. For example: This fails: http://wwww.erogol.com/?p=653 This succeeds: http://www.erogol.com/?p=653


2

Remove the 'fastcgi_intercept_errors' argument from you configuration. It's unnecessary since 'error_page' declares 404 errors, which should be handled by index.php, which will trigger PHP-FPM to handle it, and WordPress to present your theme's 404 page. It seems counter-intuitive, but 'fastcgi_intercept_errors' is actually causing PHP not to handle the ...


2

Use a later action hook You cannot use Conditional Tags before the posts_selection hook has run (as per the codex), which happens right after pre_get_posts and quite a bit after init. Hence, would it not be easier to set the cookie at a later stage of the request, rather than attempting to detect the 404 earlier (which, off the bat, I would not know how)? ...


2

Put your code in the template file category.php. Remove all the part before the loop: once in category template, you don't need to get the category, get the paged, run again the query with query_posts... So your category.php should simply appear like so: if ( have_posts() ) : while ( have_posts() ) : the_post(); $image = wp_get_attachment_image_src( ...


2

It sounds as though WorldPay is responsible for sending the overly generic name parameter so you aren't in a position to control that. You will instead have to catch the request and force it to work. Something like: function redir_404_wpse_137703() { if (is_404() && isset($_GET['name'])) { locate_template('some-theme-template.php',true); ...


2

Things are working the way they are supposed to, and possibly the only way they can work. Let me explain. Without an Apache module called mod_rewrite (or the equivalent Nginx or IIS component) requests to PHP pages have to go to an actual filesystem file. That is what you see with requests like 192.168.1.8/wordpress/?p=123. The file being accessed is the ...


2

Depends on what you mean by "redirect". If you want to 404 them, this will do the job: add_filter('wp_die_handler','custom_404_die_handler'); function custom_404_die_handler() { global $wp; $wp->handle_404(); load_template(get_404_template()); die(); } If you actually want to redirect them somewhere, then you could do something like ...


1

I have run into the same issue that using $wp_query->set_404(); would properly adjust the global object but not return the 404 template. So in the plugin I was writing I used the tried and tested method: add_filter( 'template_include', 'wp_139917_force_404' ); function wp_139917_force_404(){ global $wp_query; $wp_query->set_404(); ...


1

Change your current permalink structure to the WordPress Default Permalink structure and then again change it back to your current permalink structure. Hope it will work! If not then clear your browser cache and use Wp Super Cache plugin to clear WordPress Cache. and then open the URL test.mydomain.com/wordpress/hello/


1

First triple check your file and path names for spelling mistakes. Then check the permissions of the .js file Then take the URL from your source and open it in your browser first without the ?ver=3.8.1. Do you get a 404 in your browser as well? Then you say you call your script after the head. How exactly? Manually written into a template file? Also I ...


1

Based on your comments above: Oo, thanks, good questions. Just realized now that the Settings > Reading has nothing selected for Posts page. (The Front Page is of course set for the static home page.) The problem is, indeed, that you have failed to assign a static page as the posts page (the page ID that WordPress uses to display the blog posts ...


1

A couple of points you should try out: Remove the 'paged' => $loop->query_vars['paged'] from your $pagination array. It's not a parameter in the docs. Remove the 'base' => @add_query_arg('paged','%#%') from your $pagination array. I believe WordPress catches the paged parameter using the default page parameter. Which is it's default. Here are ...


1

There are several possibilities: you may need to enable mod_rewrite on the Ubuntu server or check/fix permissions to allow Wordpress to write to the .htaccess file. Best thing to do is read http://codex.wordpress.org/Using_Permalinks and work through suggestions.


1

You can try each one of these: Go to WordPress Dashboard > Settings > Permalinks and simply hit Save Changes. Make sure there's no index.html in your website's root directory (i.e. the directory in which WordPress files are located). Create an .htaccess file in your wp-admin directory with the following contents: <IfModule mod_security.c> ...


1

Remove the slashes on your rewrite slug. Should be like so: ... 'rewrite' => array('slug' => 'products', 'with_front' => false) ... Also, you can't have the same slug for both a taxonomy and a custom post type. They need to be unique, otherwise WP won't know which one applies to which. Additionally, if you have the slug of your ...


1

You can load your own .php files outside WordPress but you do not have WordPress' rewrite magic to support you. If you want to load the file from http://bhaa.ie/realex-ipn.php that file will have to be at the root of your installation-- same directory as license.txt. If your file is in your theme you have to load it with a complete path such as ...


1

Every front end page request on a WordPress site produces a main query. The template that WordPress decides to load is based on the results of that main query (you can see the order that WordPress does these things by looking at the Action Reference page). Despite the fact that you never output the results of that query, it's still run, and in the case of ...


1

Even if you make it works, you are running 3 different queries (get_term fire a query) in addition to the main query for any request, I don't think is the right way to do what you want. I guess that when you send an invalid tag / category / custom tax you don't find any posts, so why don't add_action( 'template_redirect', 'my_page_template_redirect' ); ...


1

get_the_ID() is broken. function get_the_ID() { return get_post()->ID; } It tries to use the member ID on a function that returns a post object sometimes: /* * @return WP_Post|null WP_Post on success or null on failure */ function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { get_posts() can return NULL, and NULL has no ...


1

Why do you want to customize the 404's core. One theme always has a file 404.php. You can do normally everything and display in this page (Get some post, images,link, tag....). If you want add a hook, try this: Are there any hooks that alter the 404 logic? Good luck.


1

I was able to get this to work pretty easily actually. I am now able to have my category base in my permalinks. This allows me to now have URLs like: http://www.new1450.dev/industries/ {Main blog post only showing category selection} http://www.new1450.dev/industries/development/ {a parent category} ...


1

It sounds like you need to copy the file /blog/index.php to /index.php and modify a line in the new copy you create: require('./wp-blog-header.php'); to require('./wordpress/wp-blog-header.php'); Here is a complete guide to moving Wordpress into a separate folder: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory


1

You'll need to add 301 redirects for the old URL to the new one. Your best bet is to do this via .htaccess, in your theme, or using a plugin like one of these: http://wordpress.org/plugins/simple-301-redirects/ http://wordpress.org/plugins/safe-redirect-manager/ Edit: Another option OPtion 2 would be to disregard the date in the URI altogether. You ...


1

Just ran into this problem and found that navigating to Settings > Media and then changing the Full URL path to files setting from http://<domain>/wp-uploads to http://<domain>/wp-uploads/<domain> eg http://blog.mysite.com/wp-uploads/blog.mysite.com



Only top voted, non community-wiki answers of a minimum length are eligible