pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

Custom Taxonomy with hyphenated names are converted to underscore names on 2.5.4 upgrade. #3095

Closed PodsBot closed 8 years ago

PodsBot commented 9 years ago

Custom Taxonomy with hyphenated names are converted to underscore names on 2.5.4 upgrade. submitted via Slack by jimtrue

jimtrue commented 9 years ago

This was brought to our attention in this Forum post: http://pods.io/forums/topic/taxonomy-names-changed-with-latest-update/

I can confirm the exact same behavior with no other items conflicting. 2.5.3 installation, created a Custom Taxonomy with hyphenated name (test-taxonomy). Added some terms to it and associated it to a Test Custom Post Type. Upon upgrading to 2.5.4, my taxonomy name was converted to test_taxonomy.

I must've been hallucinating. Took a clean installation with 2.5.3. When I created the Custom Taxonomy, it wouldn't allow me to create one with hyphens at all, so I had to edit it's configuration in wp_posts directly to make it use hyphens instead.

I added terms to the Custom Taxonomy, named test-tax and new term rows were added to wp_term_taxonomy with the hyphenated name. Upon upgrading to 2.5.4, the hyphenated name did not change, either in wp_posts or wp_term_taxonomy.

We need to confirm if perhaps this is an extended taxonomy or some other configuration (asking on forum post).

quasel commented 9 years ago

Possible related report in slack today:

user had a CPT character_directory until 2.5.3 it woked for him to use $pods= pods('character-directory') (with a hyphen!)

with 2.5.4 (latest) neither character-directory or character_directory did work he solved it by renaming his CPT to characterdirectory

weird?

cheekyboots commented 9 years ago

I don't know if this will help you, but after updating Pods, saving a post with
$pod->add( $data ); was saving everything except the custom taxonomy 'product_cat'.

In troubleshooting I also tried this, which also didn't work: $pod->save( 'product_cat', $value );

Looking in the database, it actually was adding a post_meta value for 'product_cat', rather than assigning the taxonomy term. Saving the post category in the wp-admin worked normally.

I fixed it by literally just going into the Pods admin area and viewing and then saving the product_cat taxonomy. Nothing else. Then it worked again. I thought of this because I thought maybe it wasn't the renaming that helped the above poster, but just saving the taxonomy itself.

quasel commented 9 years ago

Seems we have a weird bug hiding regarding to upgrading pods and underscore in a pod name - from which Verison did you upgrade? and did you try clearing cache before resaving the pod?

cheekyboots commented 9 years ago

90% certain I was on 2.5.3 when I hit "update". No, I didn't clear the cache. I did the same procedure on my localhost and on my production server, same problem and same solution worked.

quasel commented 9 years ago

do you have any resources left where it didn't work? would be great to test if clearing chache would help or to have mysql dumps for working / not working / before, after update - just to reproduce the error ...

pglewis commented 9 years ago

A reproducible test case would be invaluable here, so if anyone who has experienced this has a DB backup from before it happened and can reliably reproduce the behavior it's as good as a dead bug. I know there's an issue in here somewhere but chasing ghosts is hard.

lkraav commented 8 years ago

I changed my Pod name from "researchstudy" to "research-study". Pods 2.6.1 auto-converted it to "research_study" and it's visible as such at the top of pod edit page.

jimtrue commented 8 years ago

There's no difference between the two names above; do you mean research-study was auto converted to research_study?

lkraav commented 8 years ago

There's no difference between the two names above; do you mean research-study was auto converted to research_study?

Oops. That's exactly what I meant. I discarded it at first sight, but later found it affects get_post_type() etc. I just went back and manually renamed it to "research-study" again. Now it seems to have stuck.

lkraav commented 8 years ago

This is serious. I just broke a live site updating a field, and didn't notice Pods had silently converted research-study to research_study again up top. As soon as I saved, boom, everything with that CPT broken.

jimtrue commented 8 years ago

@lkraav We agree this is serious. If at all possible, so we can do a proper test against this, can you provide us a Migrate: Packages json file so we can quickly replicate what you're seeing? This will help us quickly isolate what's happening. It would also help to get the timeline of what changes you made prior to the name flipping back to underscores silently.

sc0ttkclark commented 8 years ago

Fixed in 2.6.3 (2.x branch right now)

remcokalf commented 8 years ago

I don't know if this is related, or another bug, but I have the opposite problem: My pod names have underscores, for example soort_boek. When I save anything in the pod's settings, it converts the name to soort-boek, breaking everything.

I upgraded to 2.6.4 from 2.6.1 when I noticed this. Could have been present already before 2.6.1, I did not change my pods a lot lately.