How to add custom columns to the article list in the background of WordPress

2 minutes
eight hundred and seventeen
zero

By default, the background article list of WordPress only displays information such as article title, author, publishing time, etc. What should I do when I need to display customized information for some personalized requirements?

In fact, it is also very simple. WordPress provides developers with manage_posts_columns Hook. Through this hook, we can meet our needs.

Example: Add a list of modification times

 #Add article list function add_views_column($columns) { $columns ['post_modified ']=' modification time '; return $columns; } add_filter('manage_posts_columns' , 'add_views_column'); #Populate the article reading list with data function views_column_content($column_name, $post_id) { if ($column_name == 'post_modified') { echo  get_the_modified_time('Y-n-j H:i:s'); } } add_action('manage_posts_custom_column', 'views_column_content', 10, 2);

Add the above code to function.php Save it in

WordPress后台给文章列表添加自定义列的方法
This article is written by: Shallow singing Published on Software Development of Little Turkey , please indicate the source for reprinting: //hongchengtech.cn/blog/181.html
Shallow singing
author

Related recommendations

1 year ago (2024-02-20)

Industry Fit! Preferred element of WMS warehouse management system, wms warehouse software

Enterprise managers often think that warehouses are inefficient, high cost places, and belong to heavy asset operations. With the development of enterprise business, if the warehouse needs to be expanded in traditional ways, the cost is relatively high. At the same time, it also faces problems such as lack of operating experience. In the operation link, the process of warehouse, allocation, human resource matching and management is very complicated, and the team's professional ability is also highly required
seven hundred and eighty
zero
1 year ago (2024-02-19)

Supply chain billing system management (I): system overview, what are the supply chain management fees

In recent years, with the continuous development of e-commerce industry and increasing business, everyone has started to distribute goods online, and the supply chain billing system needs to manage more and more things. How to manage the billing system? The author summarizes some contents about settlement based on his own practical experience, hoping to enlighten you. After working on the warehouse management system for several years, I was transferred to work as a supplier
five hundred and fifty-three
zero
1 year ago (2024-02-19)

Multi merchant system management - store background design, what is the meaning of multi merchant classification

Simply understood, multi merchants are a large mall. The platform can manage merchants who settle in the mall. The merchants who settle in the mall have independent backstage. They can log in and add goods to the shelves by themselves, manage their own stores and other information functions. Then how to design the backstage of the store? Let's see the author's sharing. I hope it can help you. 1、 Introduction The backstage of the store is an important part of the e-commerce platform
six hundred and forty-five
zero
1 year ago (2024-02-19)

Jiangyang District of Luzhou City took the lead in the city's full coverage training on domestic waste classification management regulations, Luzhou waste treatment

Source: Original Draft On January 10, the People's Congress of Jiangyang District, Luzhou City and the District Government jointly carried out a training on the regulations of the Regulations on the Classified Management of Domestic Waste in Luzhou City (the Regulations for short), and invited Lei Zhengyun, the chairman of the Legislative Affairs Committee of the Municipal People's Congress, to give a live lecture, so as to guide the comprehensive and systematic grasp of the contents and legal functions and responsibilities of the Regulations, deeply understand the specific specifications of the Regulations, and quickly set off
three hundred and fifteen
zero
1 year ago (2024-02-19)

Simeng CMS (smcms) content management system, Simeng Central Primary School

SMCMS (Simon CMS) is a content management system developed based on the microbee http rapid development framework. Product development follows the concept of simplicity, security, high concurrency and efficiency. Enterprise level web content management software for high-end users is designed to help users solve the increasingly complex and important web content creation, maintenance, publishing and response
three hundred and fifty-seven
zero
1 year ago (2024-02-19)

Does the website have to install a content management system?, What apps are needed to install software on the website

1: The role of the website is to let companies or enterprises display their own windows, but also to let more customers or potential customers know their work and products. Through the website, customers can understand their products and services more intuitively, and can also provide more services to meet customer needs. 2: The role of the content management system The content management system can help
four hundred and forty-eight
zero

comment

1 person has participated in the review

  • 1 year ago (2023-11-05)

    six hundred and sixty-six

    From Shaanxi
    reply

Scan code to add WeChat

contact us

WeChat: Kuzhuti
Online consultation: