Timeline for Custom Rewriting to Plugin with Parameters
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 15, 2015 at 13:25 | vote | accept | Sam | ||
Apr 15, 2015 at 13:25 | history | bounty ended | Sam | ||
Apr 15, 2015 at 13:06 | comment | added | websupporter | ouch! i should have thought of this, when you wrote 'page' instead of 'post'. Glad it works :) | |
Apr 15, 2015 at 12:36 | comment | added | Sam |
Got it working. ?p= vs. ?page_id= . I got really confused why it kept redirecting to the page without any parameters. I noticed that internally page_id is used. So my assumption is: ?p= does an redirect to ?page_id= and strips all other stuff. I have no proof for this code-based, but ultimately with using page_id it works. Thanks for your patience!
|
|
Apr 15, 2015 at 11:52 | comment | added | websupporter | the rewrite_rule() is set to 'top', right? check your rules with wordpress.org/plugins/rewrite-rules-inspector if they are placed correctly. running out of ideas :/ | |
Apr 15, 2015 at 8:35 | comment | added | Sam | Sad news... here's what I did: Download WP (4.1.1), extract, copy myplugin.php // cd wp-dir // php -S localhost:9090 Create new Page with the given shortcode as body content. Synchronize page id within myplugin.php Enable Plugin on backend // go to Settings > Permalinks and save them a few times ("Post Name" setting) foo.dom/myplugin/123 redirects to foo.dom/myplugin with no filter being displayed. | |
Apr 15, 2015 at 8:14 | comment | added | websupporter | thats quite strange to be honest. can you try it locally on a complete clean installation? i know, you say, nothing is going on, but it works for me. this is why i am puzzled. "I then created a new page using the shortcode [myplugin]" you mean, you have created a new page and in there, you used the shortcode, right? | |
Apr 15, 2015 at 7:38 | comment | added | Sam |
OK, so I was able to test this now and sadly I get literally the same result as on my tries. Here's what I did: I copied your content to myplugin.php inside /plugins and activated the plugin on the backend. After activation i went to Setting > Permalinks and pressed Save Changes to flush the rewrite rules. I then created a new page using the shortcode [myplugin] . I went to my installation foo.dom/myplugin/123 => it redirected me to foo.dom/myplugin/ and the output was filter: - no more. :'( There's no other rewrite stuff ongoing, I disabled my plugin. My htaccess is default,too
|
|
Apr 11, 2015 at 15:34 | history | answered | websupporter | CC BY-SA 3.0 |