Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm attempting to write a knowledge base plugin to consume the Salesforce API and pull in solutions in a RESTful style application path; however, some of the core plugin concepts escape me. For example, use of add_rewrite_tag from the Rewrite API produces the following argument error:

Missing argument 3 for WP_Rewrite::add_rewrite_tag()

Forgive my ignorance with the Wordpress core, but doesn't the documentation only describe two arguments?

Rather than chase an argument error which probably won't help me much in the grand scheme of things, I would like to start simple and produce statically generated content at a custom URL. For example:

http://example.com/knowledge-base/

Where knowledge-base is handled by a rewrite rule via my custom plugin which in turn would output a simple "Hello World" message with the theme's header/footer wrapped around it.

Does anyone know of an existing plugin I can review that demonstrates rewrite concepts a little more clearly than the codex documentation? It seems most examples I've run across append content to existing pages/posts whereas I'm looking to generate something entirely new based on external content.

share|improve this question

3 Answers 3

The link you've giving is for the function add_rewrite_tag() not WP_Rewrite::add_rewrite_tag()Codex.

The later documentation is a bit misleading because it links the other global function (which has two arguments) as if it was the same. But the function you're referring to has three arguments.

I updated the codex a bit to make this more clear.

share|improve this answer
    
Thanks, I didn't realize that there was an API separate from the internals. I've got a better sense for what's happening now. –  davidfrey Aug 17 '11 at 15:54
1  
@davidfrey: Well there are the docs and there is the source-code. Try to dig into the source, it's often the fastest way to find out. And take care for function names, they can look the same or similar, but are part of a class, so infact, those are different functions. –  hakre Aug 17 '11 at 22:11

The add_rewrite_tag function does indeed only take two arguments. The $wp_rewrite->add_rewrite_tag() function takes three.

Make sure you're using the base function and not trying to call the internal API calls.

share|improve this answer
1  
Indeed, I need to pay closer attention to the difference between the API and internals. Thanks for the added clarification. –  davidfrey Aug 17 '11 at 15:57

To answer the rest of your Q: Search for "Wordpress Virtual Page" in your favorite search engine. Then search for "WPSE Plugin Repository" here on the site and check out Jan Fabrys Rewrite Plugin.

share|improve this answer
1  
Serendipity, the word "virtual" came to mind on the train this morning. I'll look into it and come back to post a sample solution. –  davidfrey Aug 17 '11 at 15:56
    
@davidfrey Hopefully you come back. If you find a solution that fits, please add it as an answer. After some days you can also mark your own A as solution. –  kaiser Aug 17 '11 at 15:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.