Giter Club home page Giter Club logo

Comments (20)

funkatron82 avatar funkatron82 commented on August 15, 2024

I recently changed how taxonomy worked recently on the backend, using slugs instead of term_id's. That might be the cause. Are you using the most recent version of the code?

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

Yes, i'm using the latest version of the code, also checkbox_list and checkbox_tree are not saving the values.

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

Could you show the html generated by the code? The select elemen for example?

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

Sure

The output for select field is http://pastebin.com/jN2szLvM
output for checkbox_list is http://pastebin.com/p22cppNQ
output checkbox_tree is http://pastebin.com/Udecbnce

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

And it's not saving? That is weird. I'm using it on a test site myself and the terms get saved no problem. Trying to figure out what seems to be the problem in your case.

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

Yes, that's weird, when i create a new taxonomy field, an option is always selected not sure why, if i select other options and save the page the new options are selected (but theres no output), if i change the id of that taxonomy option the values selected are the same no sure why.

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

What do you mean there is no output?

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

if i want to show the selected values in the page, using this code:

$metas = get_post_meta( get_the_ID(), 'mc_example2', false );
// If you want to show values
foreach ( $metas as $meta ) {
echo $meta;
}

Nothing is displayed.

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

Ahh. Taxonomies aren't stored in post_meta.:

$terms = wp_get_object_terms( get_the_ID(), 'mc_example2' );
// If you want to show values
foreach ( $terms as $term) {
    echo $term->name;
}

What is the taxonomy name?

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

the taxonomy name is product type

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

without spaces

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

The code I wrote should display the terms for you. When you select something and update, does it stay selected?

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

Still not working, if i use your code, even to display the normal categories i get this error

WP_Error Object ( [errors] => Array ( [invalid_taxonomy] => Array ( [0] => Invalid Taxonomy ) ) [error_data] => Array ( ) )

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

okay, I'm stupid.

$terms = wp_get_object_terms( get_the_ID(), 'product_type' );
// If you want to show values
foreach ( $terms as $term) {
    echo $term->name;
}```

You replace product_type with whatever the name of the taxonomy is

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

If i change the id of the option the options are still selected.

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

Ok the code is working but i'm not sure about why the options are still there if i change the id

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

Just go to the Product Type edit page and delete those terms. That should do the trick

from meta-box.

RickPrice62 avatar RickPrice62 commented on August 15, 2024

Ok, thank you for your time, you're great

from meta-box.

custard-apple avatar custard-apple commented on August 15, 2024

when I'm typing $result = wp_set_object_terms( $product_ID, 'variable', 'product_type' );
getting this as output
WP_Error Object
(
[errors] => Array
(
[invalid_taxonomy] => Array
(
[0] => Invalid taxonomy
)
)
[error_data] => Array
(
)

)

from meta-box.

funkatron82 avatar funkatron82 commented on August 15, 2024

is product_type a valid taxonomy? Can you post the code that initializes this taxonomy?

from meta-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.