WordPress.org

Ready to get started?Download WordPress

Forums

Hook for wp_list_pages(); needed (7 posts)

  1. naden
    Member
    Posted 8 years ago #

    I need a way to hook wp_list_pages(); from a plugin, becuase i want to exclude a specific page from being listed.

    wp_list_pages(); isn't a hookable function and all my other tries to get controll over that function failed.

    Anybody have an idea?

    thank and regards

  2. maerk
    Member
    Posted 8 years ago #

    You might just be able to retrieve all the pages straight from the DB with a custom query.

    What do you need to do specifically?

  3. naden
    Member
    Posted 8 years ago #

    My Plugin ads a Page to wordpress "/shorturl".
    This page should be invisible, it's used only as interstitial page for redirecting. Therefor it sould no appear in the pages list.

    wp_list_pages( 'exclude=8' ); // e.g.

    solves that problem, but I don't want the user to edit the template, that's why I like to exclude the page by the plugin.

  4. maerk
    Member
    Posted 8 years ago #

    Ok, are you adding a wordpress page to the database (i.e. one of those special posts) or just a php file?

    I don't think there's an easy way to exclude wordpress pages from being edited. You'd have to change quite a bit of code in the core files.

  5. naden
    Member
    Posted 8 years ago #

    It workes great the way i pointed out. The only thing i don't want is that the user have to edit whereever wp_list_pages is getting called.

    I found some old usenet postings on that topic, if it solved the problem, i'll post it here later.

  6. maerk
    Member
    Posted 8 years ago #

    Oh I think I understand you now.

    I wouldn't have thought it possible, but I hope you find a solution!

  7. naden
    Member
    Posted 8 years ago #

    Hi, it's possible by a very ugly hack that leads to more problems than solving.
    Therefor I decided to tell the user to edit the template where wp_list_pages(); is called and add the page_id to exclude.

    Anyway thank you for the conversation ;)

Topic Closed

This topic has been closed to new replies.

About this Topic