Support » Plugins » hook plugin function to specific URL

  • Resolved vmole


    I’d like to have a my plugin hook a php function to a specific URL, so that when the URL is accessed (GET or POST), the function is called. I don’t particularly care what the URL is, just that it is a fixed value I can document.

    One solution I have: “” appears to work, and doesn’t need any setup other than putting myfunc.php into place, at least with my current setup. It feels wrong, though. It’s also called completely outside the WP system, which I don’t like much, since I’ll need to get into WP DB.

    I’d also like to avoid anything that requires external configuration of the webserver, like mod_rewrite or URL aliases. The whole point is that the user be able to install the plugin and be done with it.

    What’s my purpose? Silly, possibly. I’m writing a plugin to show what’s currently playing in my local MPD. I’d like to be able to run a script on the MPD server that POSTS to WP to update a database entry, which the WP widget/plugin can display. The plugin can’t access MPD directly (firewall, and I’m not particularly interested in exposing that port), and to make this generally useful, I’m trying to avoid hacks like FTP or SCP file transfers, etc.


Viewing 1 replies (of 1 total)
  • Having now trawled (which is completely different from “trolled”) the wp-hackers list (thanks gmane!), I find the answer is “you can’t, but here are some ways to kludge around it.” The two best answers seem to be adding a hook to the 404 processing or modifying the query processing.

    I’ll note that this seems to be a fairly common desire, and adding a straightforward, builtin way to do this might be useful.

Viewing 1 replies (of 1 total)
  • The topic ‘hook plugin function to specific URL’ is closed to new replies.