Remove the link to parent pages when using wp_list_pages as WP Navigation


Sponsored Links




How to remove the link to parent pages when using wp_list_pages in WordPress navigation is today tips that we want to share. This code original by Digital Forum user and shared by WP Garage. This tricks using pure jQuery, how to run jQuery without conflict you can revert to my Fix jQuery WordPress Conflict.

Remove Parent Link on WordPress - Alison Brie Mens Health Pic

Remove Parent Link on WordPress - Alison Brie Mens Health Pic


Let’s get started, open your header.php and add this code

<script type="text/javascript"> jQuery(function($) {     $("li.page-item-283").children("a").attr('href', "javascript:void(0)"); }); </script>

On the code above, only page 283 that link will be remove, to remove all top parent page using this code

<script type="text/javascript">
jQuery(function($) {
    $("li.page_item").children("a").attr('href', "javascript:void(0)"); });
</script>

If you have another solution, please let’s me know, our hope How to remove the link to parent pages when using wp_list_pages in WordPress navigation become more useful.

Photo from Egotastic

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

How to remove the link to parent pages when using wp_list_pages in

WordPress Tips > Code Snippets > How to remove the link to parent pages when using wp_list_pages in WordPress navigation Read More

Function Reference/wp list pages « WordPress Codex

menu_order, post_title', 'link_before Read More

WordPress › Ambrosite Unlink Parent Pages « WordPress Plugins

the output of wp_list_pages and wp_page in addition to the parent pages. Remove Link Tags: delink, menu, navigation, page, parent, unlink, wp_list_pages, wp_page_menu Read More

WordPress plugin easily creates drop-down navigation

WP Garage How to remove the link to parent pages when using wp_list_pages in WordPress navigation Read More

Removing current_page_parent from wp_list_pages from search and

When using the wp_list_pages() function to generate your navigation it will the wp_list_pages() function. Code is below (Link to current_page_parent from wp_list_pages Read More


3 Responses to Remove the link to parent pages when using wp_list_pages as WP Navigation

  1. nice tricks i really in search of it.

  2. Ferdinand says:

    I can’t get this to work! Please help! I copy and pasted it in the header change the page number but it doesn’t do anything. maybe because i was using wp_menu rather than wp_list_pages?

  3. Pingback: Disable WordPress Parent Navigation items from showing page | Css-Web-Design

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>