Setting a permalink for the home page?
I would set another page as the home page, add a custom template for the home page and put this in it: <?php wp_redirect( get_permalink( $id ), 301 ); exit; ?>
I would set another page as the home page, add a custom template for the home page and put this in it: <?php wp_redirect( get_permalink( $id ), 301 ); exit; ?>
Simply visiting the permalinks page in wp-admin will reset the permalinks. On that page you also have options which permalinks you want. Check if the home-2/ bit is not prepended there. Then ofcourse, the obvious is checking that the page ‘pagetitle’ is not a child of the page ‘home-2’. Check your trash for existing pages … Read more
I think the reason for this is the get_page_by_path() check inside the WP_Query, because it’s checking for both page and attachment slugs, in this case. So if we have both an attachment and a post with the someslug postname and visit: example.tdl/someslug then get_page_by_path() will generate the following query: SELECT ID, post_name, post_parent, post_type FROM … Read more
/%year%/%monthnum%/%postname%/
The problem likely has to do with the server settings in Nginx for your blog. It’s likely that the location rules for /blog/ are wrong, specifically try_files. It should look like this: location /blog/ { try_files $uri $uri/ /index.php$is_args$args; } This tells Nginx the order in which it should try to find the requested resource. … Read more
I would do something simplier using ID : <?php $current_id = $post->ID; ?> <?php query_posts(‘orderby=name’); ?> <?php while (have_posts()) : the_post(); ?> <li> <?php $current_class = ( $current_id == $post->ID ) ? ‘class=”current”‘ : ”; ?> <a <?php if ( $current_class ) echo $current_class; ?> href=”https://wordpress.stackexchange.com/questions/88833/<?php the_permalink() ?>”> <?php the_title() ?> </a> </li> <?php endwhile; … Read more
You can use add_query_arg() to add any query parameters you want to a URI, e.g., $redirect_uri = add_query_arg (‘page’, ‘4’, get_permalink ()) ; $login_uri = wp_login_url ($redirect_uri) ; Or, you could simply use $_SERVER[‘REQUEST_URI’], which will already contain any query string present in the current page’s URI, e.g., $login_uri = wp_login_url ($_SERVER[‘REQUEST_URI’]) ;
Say you start with a server that is completely empty. You haven’t installed WordPress yet. Now if you visit those wp-json URLs, your server goes and looks for corresponding directories / files that match your request, and of course it is empty, so as you would expect, you get 404 errors. Now install default WordPress, … Read more
You’re probably getting that error because WordPress doesn’t have the $wp_rewrite global loaded yet for some reason. Either something deactivated it, or you’re trying to run those functions before WordPress has a chance to load it. If you’re trying to do this in a plugin or in your theme’s functions.php file, make sure you’re inside … Read more
You can get the ID of the post you’re editing like this: //currently edited post id $cep_id = $_GET[‘post’]; //permalink get_permalink( $cep_id ); This is and can only work if your editing an existing/saved post. It won’t and can’t work on »Add New«-Pages, because the post you’re going to add isn’t saved to the database … Read more