假設,我想把category這個頁面,變成和page頁面一樣,可以加上詳細內容。應該怎麼修改
) z* i' H1 k% }# Tbaidu了好幾個小時沒答案,google了好幾個小時,找到一個答案,但是沒看明白怎麼操作。- function filter_category_descriptions_in_admin( $terms ) {
! ^3 L4 [( a: |, Z9 J* f - global $current_screen;$ h0 U* C- O( X3 T
- ) o* g. z2 n$ \. `0 z) {8 U
- if ( empty( $current_screen ) || 'edit-category' != $current_screen->id )
8 y! ]& q1 N0 `0 F' |0 M - return $terms;& X3 J+ W- K: w& e: R
' b" p# e0 s8 j- y* W- foreach ( $terms as $key => $term )
; A5 a; \4 W: [% F1 Y - $terms[ $key ]->description = apply_filters( 'category_description', $term->description, $term );
4 \/ C4 F- M q( ^! I; Z - 6 v. C: ]! V1 J' W! T0 {, a
- return $terms;
$ J* Z0 ?+ ^0 |) S" D7 E0 L - }
# g0 A8 J& C" m2 |% r - add_filter( 'get_terms' , 'filter_category_descriptions_in_admin' );
複製代碼 有沒有高手解答一下?
7 i! e/ R) h' E- u; C
& U. g9 K3 J3 y* `% U |