humanmade / post-cloner

Post Cloner plugin
3 stars 2 forks source link

Parent ID is set for non-hierarchical posts #8

Closed sambulance closed 4 years ago

sambulance commented 5 years ago

Cloned posts are created as children of the original post. This is documented as being so the posts have a connection. However this causes issues when the post is non-hierarchical and not expected to have a parent. An example of where this would cause an issue is in breadcrumbs. Perhaps meta data can be used to keep the post connection to its original?

mikeselander commented 5 years ago

I like the idea of using metadata for the connection. I don't think that we're actually using the parent ID anywhere so this should effectively be a non-breaking change.

roborourke commented 4 years ago

@pdewouters looks like for this one we'd just need to ensure that whatever meta value is used for this we'd need to ensure that it doesn't get cloned along with the other meta data. It should be added after the filter to remove specific meta keys I think.

pdewouters commented 4 years ago

@roborourke looks like this is already implemented, so we can just delete the code that sets the cloned post parent? https://github.com/humanmade/post-cloner/blob/master/inc/class-cloner.php#L171

roborourke commented 4 years ago

Ok cool, yeah just change the default value for the parent ID to the original post’s parent ID I think.