WordPress Post Date Changes On Update - datetime

I have my permalinks in WordPress set to the Month and Name setting. This generates URLs like /blog/2009/09/my-post-name. Every time a post is updated, it changes the posting date, which can potentially change the permalink address.
This is wreaking some havoc on my site, as I'll have banner/button ads throughout that point to the permalink. When a post from August is updated in September, all of the ads become broken links until I discover this and change it.
Is there any way to make the original posting date stay static, despite any updates? I'm looking for something like a plug-in or an overlooked setting, as I have multiple authors with varying degrees of computer literacy.
Thanks for any help!
Cory
Update:
Apparantly this is behaviour that others aren't experiencing, so I'm attaching a screen shot of exactly what's happening. Top image is before saving, bottom image is after saving.
(source: opl.on.ca)

Are you sure updating a post changes the permalink? I don't have this behaviour in my installations. What do changes a permalink is changing the post date.
In database, acoording to this schema, we have post__date and post__modified, two different attributes: used in create an update action. If you're having your post-date modified without modifying it directly
Updating a post date in Wordpress http://img18.imageshack.us/img18/3440/wordpresspostdate.png
then I'm afraid some plugin may be changing it's value.
Reading your description, I'm assuming you're using static links to your banners. Try to use a simple plugin that creates these links based on your post id: some simple routine would do it. You can get some information using get_post for example.
<?php
$my_id = 7;
$post_id_7 = get_post($my_id, ARRAY_A);
$slug = $post_id_7['post_name'];
?>
... or even easier with get_permalink. You need just your post id.
<?php
echo get_permalink(7);
?>
So, at least if your permalinks are changing without a reason and you dont know how to fix them, at least you can build them dinamically.
Just read the codex documentation and Function Reference to see what's avaiable to make your life easier!

I run the same permalink settings and don't have trouble with post updates changing the permalink. There are separate editor settings for the permalink and a user has to specifically change the permalink from that editor, which is right under the post title in the text editing box in the post editor. That's a WP thing to keep permalinks from getting broken all the time.
Maybe you should try using a few static pages? That way you can have both a clean permalink: mysite.com/mypermalink/ that won't change, if in fact your post permalinks are changing from a plugin that you need to use.

Related

How to auto edit the post in Wordpress?

Is there a way in WordPress to make posts edit themselves automatically at a certain date ?
For example, if we took a post type that can expire, after it expires I want to add a warning bar at the top of the post that says that the offer is ended without deleting the whole post also without doing it manually and also putting it in a special page for ended offers is not an option.
How can i do this ? I prefer doing it my self with code rather then using a plugin.

Permalink Goes to Old Page

I have been working on a site created by another developer. I have been fixing the site to make it more visually appealing. I am also responsible for adding new events and pictures which i self taught myself to do.
I have a situation where I have a page with the following permalink:
http://www.cic-nj.org/events/
The problem is that this link goes to a page that does not show the edits that i am making under that page and there is no other page listed that shows the info it actually displays.
this is what I have in the editor box on wordpress that I want it to show.
enter image description here
this is what appears when url is used or when i click view
enter image description here
I have been sure to click update and renewing page to view it. it's like its going to a ghost page i can not edit.
Can anyone point me in the right direction on this?
Thanks in advance...
You are experiencing "slug collision": more than one thing in your WP install has the same slug.
The problem that you have is events is a custom post type, with a slug set to events - therefore the url http://www.cic-nj.org/events/ is directing to the listing of events. This is an automatic feature of WordPress. (Note - you can see more details to support this conclusion by the fact that you've got individual events accessible at url's such as http://www.cic-nj.org/events/blue-apron-info-session/ )
Note that custom post type slugs will always take priority over a page / post slug.
You have a couple of options:
If you want a page to display the content that you've created, the page's slug / permalink must be different than events
If it's acceptable, you can rename the slug of the "events" custom post type to something different. This has the potential consequence of losing SEO "juice".
If it's acceptable, you can remove the custom post type, if you aren't going to use them any longer.
NOTE: It may be tempting to ask "how do I remove the custom post type", or "how do I change the post type slug". Those are different questions, and if you need to ask, they should be asked in a different question - not added as a comment below.

NextScripts SNAP : not using the permalink in wordpress?

This is in a way a followup of this question : Jetpack Publicize: Sharing only on Twitter for a category
I am currently working on a website in which one of the category only serves as a way to curate news on the net and then, share it on the front page and on Twitter.
The post itself is empty, I use a custom field to receive the URL from the user, grab a few things from the target website, update the permalink and save. Upon saving, SNAP publishes the post on Twitter.
My issue is that it is not using the permalink but the url of the post itself (which is absolutely empty). Having a look into the plugin's code, I saw that it was using post metas (most notably urlToUse, snap_MYURL) but couldn't determine if it was a priority issue or something else.
I also try to adjust my code to set these meta values to the url I want, to no avail.
Is there a way I could set my custom functions or the SNAP plugin so that the permalink is used ?
No answer after a week, neither here nor from SNAP's support. No problem.
The ugly patch I used :
Jetpack Publicize for all the Twitter updates
SNAP for the Facebook ones thanks to their ability of posting based on a specific category
It's bloated and I'd love to understand but, sometime, you have to ship

Custom Post Type links not working

I'm wanting to make an employee page populated from a custom post type called "Employees". It lists http://www.domain.com/employees/joe/ as the permalink but the the actual page shows up as unavailable. Am I missing something on the taxonomy side?
Thanks in advance!
Answering it because I just figured it out, but after quite a bit of googling, nothing came up, so hopefully this helps somebody.
Reset the permalinks!
For some reason, if you create a custom post type after you initially set your permalink structure, it needs to be reset. Go to your settings/permalinks, set them to default, save, and then set them back how you want, save, and you're good to go.
The permalink structure needs resetting because this regenerates the rewrite rules within wordpress, allowing the different URL segment structures to be properly recognised and processed.
Wordpress rewriting works very well, but getting around it for custom post types, custom taxonomies etc. has added an extra set of needs to the system, which are slowly being improved. The custom rewrite system was added, and it's continued development is gradually making it easier to tackle issues like this.
In many cases, a custom taxonomy is the easiest way to go.

Post privacy in Wordpress

Can a post be hidden from home page, archive view, category lists etc. and viewable only if you have a direct link to it? The blog doesn't have registered readers and is open to public so that would be a mean of hiding some posts from public view without using the password protection.
I asked this question in Wordpress section and the idea there was to use conditional code so I'm asking the question here as well to get closer to the code.
If I used conditioning, would I have to input each post's ID separately to PHP file for archive, categories, search and such?
EDIT:
After reading a bit more all over, I had an idea of creating a private category and then use some kind of conditioning so that posts from that category are hidden. According to Codex, certain category can be hidden from, for example front page but I don't know if there's a way to hide it altogether except when you have a direct link.
Creating a "Private" category is a good solution. It is quite possible to hide this category altogether except via direct link. You just have to "block all the exits" with conditional code.
The default WordPress theme displays posts via the Post Loop. See http://codex.wordpress.org/The_Loop, especially the section entitled "Exclude Posts from Some Category". Just find all the places in your theme's PHP files (e.g. index.php) where this loop is used, and add the conditional code. You'd also need to filter your category list and blog archives in the side menu. Don't add filtering in single.php, otherwise the private post won't display on its own page.
You'd probably want to add a similar condition to filter search results so that private posts aren't leaked via the blog's search tool. There may be more "exits" I haven't thought of, but I'll be sure to update as I do. I'm glad to look at specific code if you so desire.
Understanding WordPress' post query and loop really opens up a world of possibilities for customization.
I found the simplest way - just use Simply Exclude Wordpress plugin. It has the option to exclude each post (or tag, for that matter) from front page, archive, search or feed. It works flawlessly. You can still view the posts by using direct links.
(Not actually an answer that includes code but a working solution nonetheless.)

Resources