양식에서 지정한 양을 기준으로 카테고리를 만드는 플러그인을 작성하고 있습니다. 그래서 양식 페이지가 있습니다. 작동합니다. 대시 보드 메뉴에서 액세스 할 수 있습니다. 양식이 게시 될 때이 코드를 포함하는 PHP 페이지로 전송 :500 wordpress plugin을 구축하는 중 서버 오류가 발생했습니다.
//includes this file so that I can use wordpress functions
include '../../../wp-includes/pluggable.php';
//comes from the amount specified by the form
$assignmentamout = $_POST['assignmentamout'];
//comes from what to call the categories input part of the form
$namethem = $_POST['namethem'];
//if the input box for naming the assignments is blank, this is the default
if($namethem == "") $namethem = 'Assignment';
//repeat the createcat categories function for as many times as stated in the form
for ($i = 1; $i <= $assignmentamout; $i++) {
$create = $namethem." ".$i;
createcat($create);
}
//run this function as many time as the loop says
function createcat($created){
wp_insert_term($created, 'category');
}
내가 클릭 양식에 '제출'합니다. 즉시 서버 오류가 발생합니다. "HTTP 오류 500 (내부 서버 오류) : 서버가 요청을 수행하는 동안 예기치 않은 조건이 발생했습니다."
나는 wp_insert_terms()를 루프에 직접 넣어 보았고 wp_create_category()를 사용해 보았습니다. pluggable.php를 포함하지 않으면 '함수를 찾을 수 없습니다'라는 PHP 오류가 발생합니다. 나는 스크립트가 wp_insert_terms()에서 멈추는 것을 알기 위해 많은 에코를 돌았습니다. 서버 오류를 찾으려고했지만 서버에 오류가 기록되지 않았습니다. 내 php5.ini에서 내 메모리를 20MB로 늘 렸습니다. 내 플러그인 및 해당 폴더의 모든 파일은 권한 755입니다. 다른 곳에서 설치 한 플러그인은 제대로 작동하고 있습니다. wp 함수를 제거해도 서버 오류가 발생하지 않으면 페이지 끝에 에코가 출력됩니다.
아마도이 플러그인을 잘못 작성한 것일 수 있습니다. 누구든지 저에게 줄 수있는 도움은 많이 감사하겠습니다! 또는 플러그인의이 부분을 어떻게 구축할지 제안하십시오.