WordPress.org

Support

Support » How-To and Troubleshooting » Can’t get categories when running through a hook

Can’t get categories when running through a hook

  • I’ve an interesting problem: I’ve a plugin, and in the plugin I’m calling get_permalink in a function that’s hooked into the edit_post action. When the function runs in the WordPress admin, it works correctly. When it’s called by the edit_post action, get_permalink fails to get the category for the post (I’ve permalinks set to /%category%/%postname%/). I did a little playing around and found that none of the category functions work when the function is called via the edit_post action. They all do work when called on a normal admin page. The plugin used to work, but doesn’t as of WP2.3.3 (not sure when it stopped working, just noticed it). Does anyone have a clue what’s going on? Maybe how to get around it? Thanks.

  • The topic ‘Can’t get categories when running through a hook’ is closed to new replies.