Post being redirected to attachment post

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

How to remove the index.php in the url?

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

If permalink is equal to current site url

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

How to get a page url by a page id?

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

How to get url of a post from admin panel

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)