• Resolved freemason

    (@freemason)


    Hi,

    I need to change my website permalinks from domain/category/postname to domain/postname.

    I’ve been trying to write a Regular Expression (regex) to do this, but my knowlowdge is very low and couldnt succeed until now.

    Can anybody help me on this?

    Thanks in advance for your kind help.

    Regards
    A Jorge

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author John Godley

    (@johnny5)

    What regular expression have you created? Have you tested it with https://regex101.com ?

    Thread Starter freemason

    (@freemason)

    Hi John,

    Based on the regex you present in your website that removes date, name, and category in a permalink ^/\d{4}/\d{2}/\d{2}/.*?/(.*), I have been struggling with ^/.*?/(.*) to try to remove category and subcategory (if exists) from domain/category/subcategory (if exists)/postname.

    I tryed with https://regex101.com, but couldnt find the solution. Can you please help on this?

    Regards
    Antonio Jorge

    Plugin Author John Godley

    (@johnny5)

    That pattern works in regex101 when I test it:

    https://regex101.com/r/LsWtR5/1

    You may need to clear your browser cache, or any caching system you have installed.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Remove Categories with Regular Expression (regex)’ is closed to new replies.