dwest Posted March 19, 2008 Share Posted March 19, 2008 Hi, I've got a function that is part of a code snippet I insert into blog posts in WordPress. Trouble is I may insert the snippet several times in the same post. PHP throws an error of course since the function was already declared in the previous insertion of the snippet. I would add the function to the centralized functions include file in WordPress but every time I upgrade WordPress it is overwritten. I'm not likely to remember that I've got function(s) in that file that I need six months from now if I upgrade ;-) So, can I wrap the function in some sort of "if this function is declared then ignore this" thing? If so, what's the test for whether it has been declared? Thanks! Link to comment https://forums.phpfreaks.com/topic/96830-test-if-function-delared-how/ Share on other sites More sharing options...
Jeremysr Posted March 19, 2008 Share Posted March 19, 2008 I think function_exists() is what you want. Link to comment https://forums.phpfreaks.com/topic/96830-test-if-function-delared-how/#findComment-495544 Share on other sites More sharing options...
dwest Posted March 19, 2008 Author Share Posted March 19, 2008 Thanks! Link to comment https://forums.phpfreaks.com/topic/96830-test-if-function-delared-how/#findComment-495573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.