<?php
/*
Plugin Name: job list
Plugin URI: http://example.com/
Description: A complete and practical example of use of the Settings API. This plugin creates a new plugin administration page.
Author: WROX
Author URI: http://wrox.com
*/
function dwwp_register_taxonomy() {
$singular = 'Location';
$plural = 'Locations';
$slug = str_replace( ' ', '_', strtolower( $singular ) );
$labels = array(
'name' => $plural,
'singular_name' => $singular,
'search_items' => 'Search ' . $plural,
'popular_items' => 'Popular ' . $plural,
'all_items' => 'All ' . $plural,
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => 'Edit ' . $singular,
'update_item' => 'Update ' . $singular,
'add_new_item' => 'Add New ' . $singular,
'new_item_name' => 'New ' . $singular . ' Name',
'separate_items_with_commas' => 'Separate ' . $plural . ' with commas',
'add_or_remove_items' => 'Add or remove ' . $plural,
'choose_from_most_used' => 'Choose from the most used ' . $plural,
'not_found' => 'No ' . $plural . ' found.',
'menu_name' => $plural,
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => $$slug ),
);
register_taxonomy( 'location', $args );
}
add_action( 'init', 'dwwp_register_taxonomy' );
나는 워드 프레스 플러그인을 만들고 분류를 잘 모른다. 그것은 다음과 같은 오류를 준다.주의 : 정의되지 않은 변수 : C : \ XAMMP2 \ htdocs \ rateIt \ wp-content \ plugins \ job-listing.php on line 37 ( 이것은 37 행 = register_taxonomy ( 'location', $ args);)주의 : 360 행 C : \ XAMMP2 \ htdocs \ rateIt \ wp-includes \ class-wp-taxonomy.php의 배열에서 문자열로 변환
object_type 인수 (객체에 대한 객체 유형의 이름 taxonomy
. 객체 유형은 내장 된 Post 유형 또는 Custom Post Type
등록 될 수있는 모든 유형일 수 있음) 가 누락 되었으므로 다음과 같이 사용해야합니다.
register_taxonomy( 'location', array('post type / custom post type') $args );
에 추가 $
기호도 있습니다 $slug
.
여기에서이 참고 자료를 살펴보십시오.
https://codex.wordpress.org/Function_Reference/register_taxonomy
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다