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

WordPress i18n in Array throws Error

This is a PHP issue, not specific to WordPress. PHP does not allow you to declare a property as an expression. It should be a literal. So you can not call a function inside a property declararion. (see Invalid property declarations in http://php.net/manual/en/language.oop5.properties.php) The solution is to create a getter method and use it instead. … Read more

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]