We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I create a WP plugin. If i set the default value of a "select" field to "date", WP returns an error saying:
date() expects parameter 1 to be string, array given on line 283 in file --\wp-content\plugins--\includes\CMB2_Base.php
As you notice, the error is located in the file "CMB2_Base.php" on line "283"
Code Example:
add_action( 'cmb2_admin_init', 'cs_register_demo_metabox' ); function cs_register_demo_metabox() { $cmb = new_cmb2_box( array( 'id' => 'box_id', 'title' => 'Title', ) ); $cmb->add_field( array( 'id' => 'orderby_param', 'name' => 'Orderby parameters', 'desc' => 'Sort retrieved posts by parameter. Defaults to "date". ', 'type' => 'select', 'default' => 'date', 'options' => array( 'none' => 'No order', 'ID' => 'Order by post id', 'author' => 'Order by author', 'name' => 'Order by title', 'name' => 'Order by post name (post slug)', 'date' => 'Order by date', 'modified' => 'Order by last modified date', 'parent' => 'Order by post/page parent id', 'rand' => 'Random order', 'comment_count' => 'Order by number of comments', 'menu_order' => 'Order by Page Order', 'meta_value' => 'Order by string meta value', 'meta_value_num' => 'Order by numeric meta value ', 'post__in' => 'Preserve post ID order given in the post__in array', ) ) ); }
Thank you very much for your help ;)
The text was updated successfully, but these errors were encountered:
That is a known issue, unfortunately, but the workaround is documented here: https://github.com/WebDevStudios/CMB2/wiki/Troubleshooting#callable-field-parameters
Sorry, something went wrong.
No branches or pull requests
Hi,
I create a WP plugin. If i set the default value of a "select" field to "date", WP returns an error saying:
As you notice, the error is located in the file "CMB2_Base.php" on line "283"
Code Example:
Thank you very much for your help ;)
The text was updated successfully, but these errors were encountered: