Comments (20)
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.
Yes, i'm using the latest version of the code, also checkbox_list and checkbox_tree are not saving the values.
from meta-box.
Could you show the html generated by the code? The select elemen for example?
from meta-box.
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.
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.
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.
What do you mean there is no output?
from meta-box.
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.
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.
the taxonomy name is product type
from meta-box.
without spaces
from meta-box.
The code I wrote should display the terms for you. When you select something and update, does it stay selected?
from meta-box.
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.
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.
If i change the id of the option the options are still selected.
from meta-box.
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.
Just go to the Product Type edit page and delete those terms. That should do the trick
from meta-box.
Ok, thank you for your time, you're great
from meta-box.
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.
is product_type
a valid taxonomy? Can you post the code that initializes this taxonomy?
from meta-box.
Related Issues (20)
- Zion Builder Support HOT 1
- Custom Fields Group - rwmb_meta for single image no returning array HOT 1
- Contact form at metabox.io/contact is returning an error HOT 1
- Translation not showing HOT 2
- Undefined array key HOT 2
- Latest version Meta Box (5.6.9) kills MB Custom Table
- URGENT: Latest version Meta Box (5.6.10) kills MB User Meta and related plugins HOT 2
- Uncaught Error: Class 'RWMB_Update_Option' not found when adding new post type HOT 1
- Master branch here on GitHub is not current with version on Wordpress Repo HOT 2
- Switch labels are off HOT 2
- Usage of Select Advanced for taxonomies in admin HOT 1
- Require image orientation on image_advanced field upload HOT 1
- subtitle custom field HOT 2
- Media Library Never Loads HOT 3
- Fatal Error in Taxonomy Field on Frontend Form Following MB Update to Version 5.7.2
- Meta Box interferes with my website's Logo when activated HOT 1
- Scripts loaded on front end HOT 1
- Payment failed for Lifetime metabox.io plan
- WP's preview functionality broken by this plugin as of WP v6.4 HOT 2
- Impossible to preview posts since WP 6.4.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meta-box.