Search code examples
phphtmlwordpressurlpermalinks

Wordpress permalink adding "/" before index gate


I am having some trouble with wordpress and its permalink system. I need to change how it automatically adds a "/" character before its $_GET variables in the permalink section.

I am using an mvc pattern and require all $_GET requests go through the index gate to be validated before allowing it to be used and change the page. All should be fine but when a url looks like anything.com/index.php/?var=blah breaks the page and I get console errors mentioning I have an unexpected ">" in all my javascript files being called. If I go into the url bar and remove the "/" after index like so anything.com/index.php?var=blah the page loads like normal.

I need to fix the permalinks so each custom post type and tax all lead to index.php? not index.php/?


Solution

  • https://codex.wordpress.org/Plugin_API/Filter_Reference/the_permalink

    If you know how to work with wordpress hooks, this would be the filter you're looking for to alter the behavior of the permalinks.