Custom function making troubles in get_permalink for ACF relationship fields

You shouldn’t rely on the global $post variable for filters like this. In your example you’re passing $event_city->ID to get_the_permalink(). This implies that the $event_city post is not for the same post as the current $post object. This is normal. Sometimes you want to use a function like get_the_title() or get_the_permalink() without changing the global … Read more

How can I say if a URL is a post, page, or taxonomy archive?

WordPress sites usually use body_class(), which adds CSS classes to the <body> tag. If you inspect the body element itself, most sites will show you something like <body class=”page-template page-template-tpl-events page-template-tpl-events-php page page-id-1168 page-parent page-child parent-pageid-378″> You can tell from these classes that this is a Page, using a Page Template, it is a Parent, … Read more

Giving a new page an existing URL

The process to do this isn’t probably as complex as you think. Leave the existing page exactly as-is. Don’t change its slug etc. Create a new page draft Create the new page content as you’d like it to have. Once the new page is complete, and ready to go, go back to the original page … Read more

How to query 2 custom post types that need to share a slug?

Note that a filter callback must always return something which is commonly the first parameter passed to the callback. So for example your overwriteQueryVars() function, it must always return the $query because request is a filter hook. Secondly, instead of overwriting the entire query arguments (e.g. by doing $query = array( … ) or $query->query_vars … Read more

Internal linking when on a shared IP

You can wrap the links in echo home_url($path) to have them printed relative to the site. So your link would be coded as: <a href=”https://wordpress.stackexchange.com/questions/3844/<?php echo home_url(“https://wordpress.stackexchange.com/services”)?>”>

How to remove .html from admin

In my eyes the plugin is pretty useless because of two reasons: You can setup the permalinks on your own by adding .html to it. There is no need for the plugin. As Shahas Katta commented, there is genereally no need to have .html at the end of URLs. As I don’t know your site … Read more