Support » Plugin: Auto Subpage Menu » Menu-Link doesn't work properly when moving a page

  • Hi! This Plugin works great for me, with one litte problem: when I move a child page to an other parent page the link is duplicated to the new parent page, but also still remains at the old parent page, so I have two links in the menu at the end. Is this a bug or an user error?!

    Thanks in advance.

    https://wordpress.org/plugins/auto-subpage-menu/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author jojoee

    (@jojoee)

    hi ncwebdev

    I’m not sure about the issue,
    could you please try it again and if it’s still not working
    please explain me a bit more about the issue
    (or provide all steps you did to me) ?

    Thread Starter ncwebdev

    (@ncwebdev)

    I created a new (sub)page => everything works fine.

    Menu-Structure:

    Parent 1
    - Child 1-1
    - Child 1-2
    - Child 1-3 (new)
    Parent 2
    - Child 2-1
    - Child 2-2

    Then I move the subpage to an other parent page by changing the page attribte ‘parent’ like you provide on your [screenshot 2], the page is sucessfully moved to its new parent and is even shown correctly in the new position in the menu, BUT it remains ADDITIONAL on the old position in the menu.

    Menu-Structure after moving:

    Parent 1
    - Child 1-1
    - Child 1-2
    - Child 1-3 (old position <= wrong!)
    Parent 2
    - Child 2-1
    - Child 2-2
    - Child 1-3 (moved <= correct!)

    I hope you can reproduce my steps now more clearly. πŸ™‚

    Plugin Author jojoee

    (@jojoee)

    Hi ncwebdev,

    Your explanation is clearly, but I can’t reproduce it.
    I’ve tested it on wordpress version 4.3.3 and it’s working fine.

    Which version of wordpress you use ?
    so I can test it again on your wordpress’s version.

    *note
    Sometime, it’ll conflict if you have any activated themes or plugins that have a feature like/similar this.
    Normally, when I face an issue that I’m not sure whether is it come from this plugin or not, I just try installing (fresh install) and activate only this plugin and reproduce the issue again.

    Feel free to inform me, Cheer πŸ™‚

    Thread Starter ncwebdev

    (@ncwebdev)

    Hi jojoee,

    I’m running the latest WP-Version (4.4.2) with the BeTheme theme. I don’t think that their is a conflict with an other plugin, because I have deactivated the most of them, but I will test it on a clean install later, too.

    Kind Regards…

    Thread Starter ncwebdev

    (@ncwebdev)

    Hi!

    just tested it with a clean install (4.4.2) and a standard theme (Twenty Sixteen), still the same problem as descripted above.

    Cheers.

    Plugin Author jojoee

    (@jojoee)

    Hi ncwebdev,

    I have tested it on 4.4.2 and
    use Twenty Sixteen (latest version) theme as you did,
    but it’s working.

    I’m totally don’t know why it’s not working on you side.
    Anyway, I’ll try to figure out the root cause to help you.

    Plugin Author jojoee

    (@jojoee)

    Hi ncwebdev,

    This is step when I tested
    1. Install latest wordpress version
    2. Go to plugin panel
    3. Search + install + activate “Auto Subpage Menu” plugin
    4. Go to menu panel
    5. Create new menu and set it as a “Primary Menu”
    and also check “Automatically add new top-level pages to this menu”
    6. Create “Dog” and “Cat” pages (parent page)
    7. Create “Baby dog 1” page and set “Dog” page as a parent page
    8. Create “Baby dog 2” page and set “Dog” page as a parent page
    9. Create “Baby cat 1” page and set “Cat” page as a parent page
    10. Create “Baby cat 2” page and set “Cat” page as a parent page
    11. Change parent page of “Baby dog 1” from “Dog” to “Cat”

    Thread Starter ncwebdev

    (@ncwebdev)

    Hi jojoee,

    sorry for the late reply but I have been on easter vacation. πŸ™‚

    I tried it exactly as you mentioned it above but still the same problem. When I moved the Baby-dog-1 from dog to cat , I become a double entry, one unter dog and one under cat.

    That is more than curios … :-/

    Plugin Author jojoee

    (@jojoee)

    Hi ncwebdev πŸ™‚
    How’s your vacation going ?

    Yes, I want to understand this issue too but I can’t replicate it.
    Now I try to figure out how to replicate your issue.

    Feel free to letting me know in any update.

    Plugin Author jojoee

    (@jojoee)

    Hi ncwebdev

    How do you do ?
    I always looking forward to a way to replicate this issue and
    I don’t know why I can’t remember the best way to replicate it.

    Can you send me a sql file (from tested db) and whole wordpress folder
    (that you have tested about this issue) ?

    I recommend google drive (https://drive.google.com/) for uploading files.

    Cheer πŸ™‚

    Thread Starter ncwebdev

    (@ncwebdev)

    Hi jojoee

    Thx for your support. I have put a dump on my dropbox for you:

    https://www.dropbox.com/ (Please drop me a note when you have downloaded it.)

    Kind Regards…

    Thread Starter ncwebdev

    (@ncwebdev)

    Yeah!!!!!!!

    I found the bug in your plug-in and now I know, why you can’t replicate my problem. πŸ™‚
    Your plug-in is working fine when you uses the default table-prefix (“wp_”), but as I have multiple WP-installations in my database I uses a custom table-prefix for each installation.
    In your function remove_page_from_menu you named the table wp_term_relationships straight.

    I have updated your function like this and now it seems like it works.

    function remove_page_from_menu( $object_id ) {
    	global $wpdb, $table_prefix;
    	$query = sprintf( 'DELETE FROM '.$table_prefix.'term_relationships WHERE object_id = %d', $object_id ); 
    
    	$wpdb->get_results( $query, OBJECT );
    }

    I will make some more tests and report later … πŸ™‚

    Thread Starter ncwebdev

    (@ncwebdev)

    Hi jojoee,

    it’s me again. πŸ™‚
    Have checked the modified plugin and found one minor thing which maybe could be improved: When the moved page have children itself, they are not moved with their parents but were moved to the top level.

    Before:

    parent 1
    > child 1-1
      > child 1-1-1
    parent 2

    When I move "child 1-1" to "parent 2" it will become

    parent 1
    parent 2
    > child 1-1
    child 1-1-1

    Maybe you can improve your plugin that it can also handle that sub-pages?

    Kind Regards… πŸ™‚

    Plugin Author jojoee

    (@jojoee)

    AWESOME!!! I’m very appreciate it.

    I’ll fix it (sorry for that T_T).
    Your suggestion is very good, I’ll add this feature too.

    Thank you again πŸ™‚

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Menu-Link doesn't work properly when moving a page’ is closed to new replies.