Plugin to Consume a Web Service

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?

Read More

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.

Related posts

Leave a Reply

3 comments

  1. 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.

  2. 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.

  3. 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.