Hi,
We have the same problem at the back end we cannot use the admin fields in our products anymore after the last update..
Best regards,
Hi, in that field’s configuration, please check for the “Read Only” option, whether it has been set to “Show as Read Only” or “Show as Normal”, it should be “Show as Normal”.
Hi Saravana,
yes wel did this and works but I need to change a more than 100 fields.
is there a bulk change possible?
and normaly this “Show as Read Only” or “Show as Normal” is or was an option for the front end. will this be the same?
No problem, I will post a snippet for the bulk update shortly.
Create a Page in your Back end Admin, name of the page should be Migrate.
Create a .php file in your active theme directory, name of the file should be page-migrate.php
place the below snippet on that file.
/* Fetching all the fields factory admin post */
$posts = get_posts(array('post_type'=>'wccaf', 'posts_per_page'=>-1));
if( count( $posts ) > 0 ) {
/* Go through each post */
foreach( $posts as $post ) {
setup_postdata( $post );
$_pid = absint( $post->ID );
/* Fetch all fields from a post */
$meta = get_post_meta( $_pid);
/* Iterate through each field */
foreach ( $meta as $key => $val ) {
if ( preg_match( '/"wccaf_"/', $key ) ) {
if ( $key != 'wccaf_condition_rules' &&
$key != 'wccaf_location_rules' &&
$key != 'wccaf_group_rules' &&
$key != 'wccaf_pricing_rules' &&
$key != 'wccaf_fee_rules' &&
$key != 'wccaf_sub_fields_group_rules' ) {
/* Decoade the meta of a single field */
$field = json_decode( $val[0], true );
if ($field && isset($field["show_as_read_only"])) {
/* Update the read only proprty */
$field["show_as_read_only"] = "no";
/* Update the meta */
update_post_meta( $_pid, $key, wp_slash( json_encode( $field ) ) );
echo '<p>'. $key .' updated successfully.</p><br/>';
}
}
}
}
}
}
Now from the browser call that page http://your-site-url.com/migrate
That call will execute the snippet on the page-migrate.php, once done delete that file from your active theme directory.
Check your admin fields whether the fields are updated.
Caution: I haven’t tested the snippet, though it doesn’t contain anything that can corrupt your fields.
Hi,
I tried it a few times but it doesn’t change to Show as Normal.
only if I make a new Field it is on Normal automatically(i believe it was already standard.
best regards,