Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Wrong parent selected with some characters

$
0
0

Replies: 1

Let’s say I import a series of 3-level categories:

category1 / category2 / category3a
category1 / category2 / category3b
category1 / category2 / category3c
category1 / category2 / category3d

Result:

category1
-category2
--category3a
--category3b
--category3c
--category3d

(correct, as expected)

with slash in name string (converted to html entity)

category/1 / category/2 / category/3a
category/1 / category/2 / category/3b
category/1 / category/2 / category/3c
category/1 / category/2 / category/3d

Result:

category/1
-category/2
--category/3a
-category/3b
-category/3c
-category/3d

(3a has correct parent, 3b-d have grandparent as parent)

with slash and slug

category/1$category-1 / category/2$category-2 / category/3a$category-3a
category/1$category-1 / category/2$category-2 / category/3b$category-3b
category/1$category-1 / category/2$category-2 / category/3c$category-3c
category/1$category-1 / category/2$category-2 / category/3d$category-3d

Result:

category/1
-category/2
--category/3a
-category/3b
-category/3c
-category/3d

(3a has correct parent, 3b-d have grandparent as parent)

with ampersand in name string

category & 1 / category & 2 / category & 3a
category & 1 / category & 2 / category & 3b
category & 1 / category & 2 / category & 3c
category & 1 / category & 2 / category & 3d

Result:

category & 1
-category & 2
--category & 3a
-category & 2
--category & 3b
-category & 2
--category & 3c
-category & 2
--category & 3d

(generates multiple categories for 2)

with ampersand and slug

category & 1$category-1 / category & 2$category-2 / category & 3a$category-3a
category & 1$category-1 / category & 2$category-2 / category & 3b$category-3b
category & 1$category-1 / category & 2$category-2 / category & 3c$category-3c
category & 1$category-1 / category & 2$category-2 / category & 3d$category-3d

Result:

category & 1
-category & 2
--category & 3a
-category & 3b
-category & 3c
-category & 3d

(3a has correct parent, 3b-d have grandparent as parent)

I can understand the confusion when the slug is not defined. But when the slug is defined, it should be easy to find the correct parent. It looks like we’re just looking for the string after the first slug delimiter instead of the second.


Viewing all articles
Browse latest Browse all 59525

Trending Articles