loic.etibe
Forum Replies Created
-
Forum: Plugins
In reply to: [Link Image Gallery] Plugin broke my posts' image galleryMaybe you just have to change the regexp to allow both ?
Like :
var matches = iframeParent.match(/[link\.php|link\-add\.php]/);I’m not sure about the regexp, but it’s something like that ^^
Forum: Hacks
In reply to: Custom Post slug and nav_menu_item slug collisionsHello back.
I couldn’t find any way to exclude the nav_menu_item’s from the requests, so I tried the other way around : altering the post_name at insert time.
So, here is a function to add to a ‘wp_insert_post’ action hook :
add_action(‘wp_insert_post’, ‘nav_menu_items’, 8);
[Code moderated as per the Forum Rules. Please use the pastebin]
Important Notice : the wp_insert_post hook is actually called at the end of the insert/update function and I couldn’t find a way to limit it to the inserts only. The overhead doesn’t seem too high so I think it’s OK. And it will solve the problem for all pre-existing menus.
Enjoy 🙂
Forum: Hacks
In reply to: Are plugins inside of the loop?Where is your code located ? In a hook ?
You should at least have access to the WP_Query object, except if you’re in a very early state.What’s the output of var_dump( $wp_query ); ?
Forum: Hacks
In reply to: Are plugins inside of the loop?No, they are not. You can pass the ID of the post you are processing to your plugin or make a new loop inside it, depending on what you are trying to do.