• Resolved ericebdy

    (@ericebdy)


    Hello
    I am trying to access the “wp_insert_term” function which is in “wp-includes / taxonomy.php” from a file located in the “plugin” directory, the paths “ABSPATH. ‘wp-includes / taxonomy.php ‘”or” mydomain / wp-includes / taxonomy.php “do not work.
    what is my mistake?
    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Eric, you should be able to use wp_insert_term directly in your plugin as it is a standard WordPress function & you should not need to include the WordPress core file.

    Can you please share more details as to what you are trying to do/achieve so that I or someone else can help you out in a better way?

    Thread Starter ericebdy

    (@ericebdy)

    Thanks for your reply, it got me thinking, and I rewrote my file differently and now it works.
    But I have a new question how to get the id of a term with its name, I’m trying to use the get the term function:
    $ id = get_term_by ($ myslug, $ myterm-name, ‘product_cat’);
    but I get nothing:
    var_dump ($ id) = false
    Thank you

    Thread Starter ericebdy

    (@ericebdy)

    ok i found it!
    this is :
    $ id = get_term_by (“slug”, $ myslug, ‘product_cat”);
    have a good day

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘path for taxonomy.php from admin’ is closed to new replies.