Hot answers tagged

5

I am not sure if this is the best solution or not, but it works: function movie_review_permalink( $url, $post, $leavename ) { $category = get_the_category($post->ID); if ( !empty($category) && $category[0]->slug == "test" ) { //change 'test' to your category slug $date=date_create($post->post_date); $my_date = ...


4

I want ot give you an "alternate" approach. I'm pretty sure you're not going to follow this, but I thinks is interesting to read. OOP "routing" approach In WordPress, "pretty" urls are mathed to "ugly" urls. But most web frameworks (not only PHP) uses the concept of "routing": to match an url to an "action" (or a controller). I want to give you an idea ...


1

You can always use the post ID to link to a page, like this: http://yourdomain.tld/?p=1234 You can find out the Post ID right from the post overview screen. If you hover over the "Edit" or "Delete" link, you can see that the URL has a parameter post=. The number behind that is your page ID. It could happen, that WordPress redirects your "post ID ...


1

It may seem like WordPress is intelligently redirecting old URLs, but what it's doing is just guessing, and mostly getting it right due to the nature of your posts and URL structure being unique enough for it to guess correctly. There are cases where it'll get this guess wrong. You can see where it does this in WordPress source, the function is aptly named ...



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