PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 19, 2022

[FIXED] How to add page URL to list of pages in WordPress admin panel?

 October 19, 2022     admin, wordpress     No comments   

Issue

Currently, by default, the following columns appear in the list of pages in the WordPress admin panel:

Title

Author

Comments

Date

and because I have AIO SEO installed:

SEO Title

SEO Description

SEO Keywords

Is there a way to have WordPress also display the URL to the page (at least the part of the URL that is created when the page itself is created)?


Solution

The page url is actually already there by default, it's just hiding. When you hover over a page title, several links appear below the title -- edit, quick edit, trash, view. View is the hyperlink to the page, which you can click to view the page, or right click and copy the link address to use elsewhere.

Otherwise, if you are using a custom/child theme, you could add the following to your functions.php file:

add_filter('manage_page_posts_columns', 'my_custom_column', 10);
add_action('manage_page_posts_custom_column', 'add_my_custom_column', 10, 2);


function my_custom_column($defaults) {
  $defaults['url'] = 'URL';
  return $defaults;
}

function add_my_custom_column($column_name, $post_id) {
  if ($column_name == 'url') {
    echo get_permalink( $post_id );
  }
}

Note: This just creates a text url to your page.

Also note, you do not want to edit your functions.php file directly if you are using a theme you did not create, as it will be overwritten when you update. If you want to add this to an existing theme, I'd suggest looking into child themes.



Answered By - seancdavis
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing