Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#16064 closed defect (bug) (duplicate)

Cannot update number of items per page for taxonomy with dashes in name

Reported by: garyc40 Owned by: garyc40
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: General Keywords: has-patch needs-testing 3.2-early
Focuses: Cc:


Test case:

add_action( 'init', 'test_register_post_type' );

function test_register_post_type() {	
	register_taxonomy( 'test-tax', 'post', array(
		'label' => 'Test Tax',
		'hierarchical' => true,
	) );

Try going to edit-tags.php?taxonomy=test-tax, and update the number of items per page in Screen Options. It won't have any effects.

This is because in various places, dashes in the taxonomy name are converted into underscores when checking for the user option. I don't know the rationale behind this, and I'm not sure whether a taxonomy name mustn't have dashes in it.

If dashes are not allowed in tax name, then in register_taxonomy(), we should automatically convert all dashes to underscores.

Otherwise, patch attached. The patch still preserve the user option name (in which only underscores are used). For other parts, the normal tax name is used.

Attachments (1)

16064.diff (3.0 KB) - added by garyc40 8 years ago.
there's a patch for that

Download all attachments as: .zip

Change History (5)

8 years ago

there's a patch for that

#1 @garyc40
8 years ago

I should add that there might be existing developers who are already using dashes in their taxonomy name. As a result, automatically convert dashes to underscores in register_taxonomy() would probably break those plugins / themes.

#2 @ocean90
8 years ago

Maybe related: #15970

#3 @garyc40
8 years ago

  • Resolution set to duplicate
  • Status changed from new to closed


Actually, this is a duplicate of #15970. ryan's patch over there looks good.

Thanks for pointing that out.

#4 @ocean90
8 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.