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

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

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

Edit file wp-config.php in root & define site url and home url: define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com'); And go to admin dashboard and update permalink (Settings => Permalinks => Update).


2

In wamp you have to manually click/unclick an option to change the .htaccess(and allow permalinks with that). To do this , click the wamp icon on your (windows) task bar, choose apache > apache modules and check 'rewrite module'


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

Your get_author_posts_url() seems wrong, it doesn't accept three parameters. Passing ID as first one should be sufficient to generate correct link, name argument is pretty redundant there.


2

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 ...


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

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

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 ...


2

Error pages are served up via .HTACCESS, if you are using Apache you would use the ErrorDocument directive and add the status and URL to it. So it would look like this in your .htaccess file: ErrorDocument 401 http://yourwebsite.com/error-401 ErrorDocument 403 http://yourwebsite.com/error-403 ErrorDocument 500 http://yourwebsite.com/error-500 You could ...


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

You should set your publicly_queryable argument to true when registering your custom post type. TAKE NOTE: Add flush_rewrite_rules(), refresh the page once or twice and REMOVE IT IMMEDIATELY. You SHOULD NOT keep flush_rewrite_rules() unless under the provisions as in the codex. this is an expensive operation so it should only be used when absolutely ...


1

You can include the search form in your 404.php file using the get_search_form() function. Using get_sidebar( '404' ); would look for a file called sidebar-404.php and fall back on sidebar.php if needed. get_sidebar()


1

It is possible but wordpress doesn't have any helpful constructs to help with that. The best approach is to modify your 404.php. Most of the information that you need should be in the main WP_query object and you should be able to do something like if (is_singular('post_tyoe_a')) { .... } else { .... } this is extremely untested and you might need ...


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

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

I am about 99% sure the reason for much of this is that someone has used relative links in the post body. A link that looks like this: <a href="www.whufc.com/">Some link Test</a> Will end up looking like this: 2010/premiership-forecast-title-race-hots-up-gunners-prepare-for-adebayor/www.whufc.com/ If it shows up on this page of the site: ...


1

some time it's most likely the permalink structure is missing or something went wrong after migration from localhost to live server, the solution is reflush permalink rules to avoid 404 errors.


1

you're using name='name' for your first input. That breaks it. Change the name to something else as suggested above, prefix everything. name='my-prefix-name'


1

This is an issue when installing mod_security2. The solution is as simple as disabling mod_security or allowing that page to POST that request. The issue is that mod_security thinks someone is trying to hack into your site.


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

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

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 ...



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