Custom permalink to make a page respond properly

I found the answer by tracing through the wordpress code, wasn’t easy, this code is really a complete mess but hell, i made it through… The solution comes in 3 different parts: Register your custom post type / Custom permalink structure Generate your custom rules / Overwrite existing rules Overide the redirect canonical filter to … Read more

Leverage permalinks with AJAX

You can do that with html5 history API with which you can change the URL at the address bar whenever you want. Works on anything modern which is not IE, but maybe this utility will help with IE.

Permalinks of New Pages and their Parents

NOTE: The information below is somewhat inaccurate. My mistake. The Page hierarchy is shown in permalinks, and the article I linked to discusses changing it in Posts. Thanks for the correction, @Milo. Original Post: You may not like this answer, but WordPress doesn’t include page hierarchy in urls. It is for use in your theme … Read more

Overwrite URL on blog posts

If you are not using Custom Post Types the following in your permalink settings should work just fine. /blog/%postname%/ Screenshot (Below can still be applicable depending on your use of custom post types) Keep your regular permalinks on blog like you have it in settings. And in your custom post type arguments the “with_front” Boolean … Read more

Permalinks in Multisite not working

For permalinks you may have to include index.php before the custom permalink structure within the permalinks settings option panel: /index.php/%postname%/ Just a guess but thats what I had to do on a couple of my sites. Let me know if that does not work and then we can look at your .htaccess file.

get_permalink to attachment not working

The Problem is that you query for Post Status null. Try setting this to publish or inherit, because get_permalink is a function for published items, not for any post status. This is because Permalinks to items with a status like draft should not be shown to the user.

Custom rewrites for pages and categories

If you want to have domain.tld/PAGE-NAME.php then you could just use %postname%.php as custom structure. // Edit As this approach seems to work for posts only, you might have a try with the structure /%postname%/. In addition, you put the following lines to your .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*).php /$1/ [R=301,L] </IfModule> // … Read more

wp_get_attachment_url not working

Add the PDF attachment ID as a custom field value, for example attached_pdf_id. Get the URL using wp_get_attachment_url(): <?php if ( is_user_logged_in() ) { $pdf_link = wp_get_attachment_url( get_post_meta( get_the_ID(), ‘attached_pdf_id’, true ) ); if ( $pdf_link ) { ?><a href = “https://wordpress.stackexchange.com/questions/89809/<?php echo $pdf_link ?>” >Download</a><?php } else { ?>Sorry, no link available. Please contact … Read more