Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter loic.etibe

    (@loicetibe)

    Maybe 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 ^^

    Thread Starter loic.etibe

    (@loicetibe)

    Hello 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 ??

    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 ); ?

    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.

Viewing 4 replies - 1 through 4 (of 4 total)