Save meta value as an array of arrays

If you don’t need to query on the data, you can pass arrays directly to the post meta functions, WordPress will automatically serialize/unserialize the data for you. $your_array = array( array( ‘title’ => ‘something’, ‘price’ => ‘something’, ), array( ‘title’ => ‘something’, ‘price’ => ‘something’, ), ); update_post_meta( $post_id, ‘your_key’, $your_array );

Website Warning: call_user_func_array() expects parameter 1 to be a valid callback, class ‘Wppr_Public’ does not have a method ‘amp_support’

The warning message is pretty clear. You’re passing method amp_support from class Wppr_Public as callback, but this class doesn;t have such method… So how to fix it? You should find that class and look for this function. Maybe it’s some typo or that method changed its name or moved to another class or something like … Read more

how to get post order by post id wp_query?

OK, so you want to define posts order by yourself. WP_Query allows you to do that – you’ll have to use orderby => post__in to achieve it. And that’s what you do. So why isn’t it working? Because of a typo 😉 Ordering posts by post__in preserves post ID order given in the ‘post__in’ array. … Read more

How to display line breaked meta values in table?

You can use explode() or preg_split(), like this: $i = 0; foreach( $namesArray as $key => $name ) { $arr = explode( ‘ -‘, $name, 2 ); //$arr = preg_split( ‘/\s+\-/’, $name, 2 ); $name2 = isset( $arr[0] ) ? trim( $arr[0] ) : ”; $role_name = isset( $arr[1] ) ? trim( $arr[1] ) : … Read more

Alter required message using comment form api

What you need to use is comment_form_defaults filter that has large and nested $defaults array passed. That array will have (among other things) something like this in it: fields author << this will have something like <span class=”required”>*</span> in it email << this will have something like <span class=”required”>*</span> in it url comment_notes_before << this … Read more

Save meta box values as an array to wp_postmeta

In PHP, there is no need to use the square brackets that are required in an HTML form name to indicate an array, such as you get when using checkboxes. In other words, this in HTML: <label><input type=”checkbox” name=”brand[]” value=”1″> Brand 1</label> <label><input type=”checkbox” name=”brand[]” value=”2″> Brand 2</label> <label><input type=”checkbox” name=”brand[]” value=”3″> Brand 3</label> Will … Read more

How to decipher the following array

You’re looking at a serialized representation of the array Array( ’75’, ’68’ ). Serialization is the process by which PHP stores a data object as a string, much like the manner in which JSON is a string representation of a Javascript object. PHP data structures may be converted into a serialized format via PHP’s serialize(), … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)