Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7669961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:42:49+00:00 2026-05-31T15:42:49+00:00

I am writing a plugin that creates categories based on an amount specified by

  • 0

I am writing a plugin that creates categories based on an amount specified by a form. So I have the form page, it works, you can access it from the dashboard menu. When the form is posted it sends to a php page with this code on it:

//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');
}

If I click ‘submit’ on the form. I immediately get a server error: “HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.”

I tried putting the wp_insert_terms() directly into the loop and tried using wp_create_category(). If I do not include the pluggable.php I get a ‘function not found’ php error. I ran a lot of echos so I know that the script just stops at the wp_insert_terms(). I tried to look up server errors, but my server didn’t log any errors. I increased my memory in my php5.ini to 20mb. All my files in my plugin and its folder are permission 755. Plugin’s that I have installed from elsewhere are working properly. If I remove the wp function I get no server error, the page outputs echos I put at the end.

Maybe I am just building this plugin incorrectly. Any help that anyone could give me would be much appreciated! Or maybe suggest how you would build this part of a plugin.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:42:50+00:00Added an answer on May 31, 2026 at 3:42 pm

    So I looked up my server logs to see what the problem was. Looks like I needed to include the taxonomy.php not the pluggable.php. I had to include a lot of different wordpress pages by the end of this plugin. And you can find what php page each function is called from in the wordpress documentation at the bottom of the page of the function you are reading about. I guess moral of the story is: a 500 error = look at your server logs! AAAHHHH noobs…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been writing some code that creates a generic blog. Its features are
I'm writing my first Wordpress plugin and need to add a page that does
Currently I have a 3D Cube that I drew by writing coordinates, that can
I'm writing a simple plugin based program. I have an interface IPlugin which has
I am writing a plugin that creates a select marquee box when the mouse
I'm writing a plugin that will allow parameters to 'set it up.' But I
I'm writing a plugin that's modifying an existing UI. One thing I want to
I am writing a wordpress plugin that redirects the user. for some reason, wp_redirect
I'm playing around with writing a jQuery plugin that uses an attribute to define
I'm writing some plugin code in a dll that is called by a host

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.