An array (in PHP) is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array ...

learn more… | top users | synonyms

1
vote
0answers
13 views

array of objects to do_action, callback gets singular object?

So I was passing an array of objects through an action today, no biggy, and things were working fine. Until I was iterating over one of the arguments to a callback and started getting errors. The only ...
0
votes
0answers
7 views

Parse error on user_register

I am trying to add a matching system. When I signup it will loop through all users that have the same interest as me, interests are done in checkboxes and put in one array. This is my whole function: ...
0
votes
1answer
20 views

display post tags on single.php inside loop

I want to display the tags of the current post in the single.php and do the following: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1 class="single_h"><?php ...
-1
votes
1answer
20 views

wp_postmeta store multiple values in one key [closed]

I am currently storing some data in a custom field like this: $get_ref = $_SERVER['HTTP_REFERER']; $ref = get_post_meta($post->ID, 'page_ref', true ); $ref[] = $get_ref; ...
-2
votes
1answer
348 views

echo is just displaying the word 'array', rather than the array [closed]

I'm trying to see the structure of an array, but when I try to echo the array, all it says is 'array'. Please can someone explain how I can see the structure of an array? add_shortcode('book', ...
1
vote
4answers
307 views

Updating wp_options with an array on save_post results in duplicated entries

I'm not entirely sure this is Wordpress' fault, but I figure I'd ask anyway and see if anyone else has experienced any problems like this before. I'm trying to save an array to a wp_options table ...
2
votes
2answers
77 views

Automatically adding meta data to posts or multiple query help

I run an events company whose website uses a custom post type system for posts (blog), events and tickets all stored as CPT's in the DB. On the guestlist (which counts 'ticket' custom posts if the ...
0
votes
1answer
8 views

Category based on post id

I have the following: $custom_loop = new WP_Query( array('category_name'=>$category, 'meta_key'=>'name', 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page'=>'-1')); How ...
0
votes
0answers
33 views

how to get sub fields using advanced custom fields?

I am a compete beginner with Advanced Custom Fields. I would like to get your help in understanding acf well, most probably a simple question. I have a blog I use acf to categorize the posts. I use ...
0
votes
1answer
27 views

Widget checkbox array empty on update function

I have a widget that is not passing checkbox state to $new_instance, specifically $instance[ 'posts' ]; if I dump $new_instance in the update function it is empty? All the other instance variables are ...
0
votes
1answer
59 views

Output comment_author in array

In functions.php for part of custom comments, I have the following echoed array as the link to respond to a previous comment: <?php echo comment_reply_link(array( "before" => " <span ...
0
votes
1answer
826 views

Removing duplicate values between two wordpress queries

I'm addressing a well known issue in Wordpress, in which I want to display "featured" posts, and under it the rest of the posts. I have a $query1 which holds 2 featured posts, and my query_posts which ...
1
vote
2answers
30 views

How to use IN array properly in Wordpress?

I have an array containting these values (including the apostrohpes): 'course_3202','course_3201','course_3200','course_3199' I try to fetch results from these values in postmeta-table. SELECT * ...
1
vote
3answers
31 views

get_*_meta doesn't always return an array

I find it annoying that functions like get_user_meta or get_post_meta will return an array if the meta key exists or false if it doesn't. This means I need to do a check like so: $meta = ...
-1
votes
1answer
50 views

posts_per_page - Repeats only first posts 'post__in' array

This question correlates with a previous question I was able to solve here: http://wordpress.stackexchange.com/a/137929/28389 I am using an array for 'post__in', and I am able to run this no problem. ...
0
votes
1answer
46 views

How to get specific string in explode array?

I have a shortcode where I'm trying to get a specific string from the $args array below. Query: <?php $args = array( //'post_type' => $posttype, 'post_type' => explode( ', ', $posttype ), ...
0
votes
1answer
33 views

How to avoid filling up an array each time I run a WP_query?

I am making a following user system and need some help for retrieving the users ids a user is following. At the moment I am using the following SQL query for retrieving the users ids a user is ...
0
votes
2answers
36 views

post__in - Placing content from a foreach loop inside of an array

I know this code is incorrect, but it's a basis of what I am trying to achieve. I am parsing an xml feed via PHP and running a foreach loop to get a value from a specific key. Here is the snippet I ...
0
votes
1answer
30 views

Removing a taxonomy term

There is a Wordpress function called wp_remove_object_terms that unfortunatly doesn't seem to work. I am trying to achieve the same ends using the following $post_terms = wp_get_object_terms( ...
-1
votes
1answer
18 views

Populate Array with values from another arrray [closed]

I have retrieved WP_Post object and i stored it in a variable. Array ( [0] => WP_Post Object ( [ID] => 45 [post_author] => 1 [post_date] => 2014-03-10 14:22:01 ...
0
votes
0answers
39 views

Sort taxonomies in select dropdown with topmost parents as optgroups

I have an array of objects with custom taxonomy terms. This taxonomy represents a list of countries/states/cities which are being used by a certain post type and other parameters (I'm not using a ...
0
votes
1answer
28 views

Minimize database queries to user tables?

I'm trying to come up with a strategic way to collect large amounts of usermeta data (and output to the screen) while keeping database queries low. Some pages, like the home page, single pages, and ...
0
votes
0answers
26 views

Get taxonomies inbetween WP_Query?

Basically I have two loops that work seperately but I need information of one of the loops to go into a listing which happens to be in the other loop. This concerns fetching custom taxonomies and ...
0
votes
0answers
31 views

Working with arrays/foreach statements - echo results? Addition operator w/foreach… multiplying?

I'm really struggling with this - I'm relatively new to PHP but I'm trying make this code that I've pulled together output a list of chapters sorted by user pageviews based on a user_meta field called ...
0
votes
0answers
27 views

How to output data from meta box with cloned fields?

Just to let you know, i am at a beginner level with PHP, so please bear with me : ) Also, I looked at this post and I did not find it helpful in my case, so I am making a stab at it here. (Meta Box ...
1
vote
2answers
454 views

How to write: $wpdb->update having WHERE NOT value pair in the array

I need to update all meta keys in the postmeta table that have a value other than 0, to the value of 0. I tried this.. no love (though I cannot figure out why....): $status = $wpdb->query("UPDATE ...
0
votes
1answer
73 views

Update value of a associative array with update_post_meta

I am trying to change the value of a specific key of an associative array which was saved in my post meta. This is how my array is saved in a custom field: Array ( [0] => Array ( ...
0
votes
1answer
81 views

Metabox radio buttons not saving correctly

I have multiple radio buttons set up inside of a metabox in a custom post type. I have created the metabox like so: add_action('admin_init', 'add_meta_boxes', 1); function add_meta_boxes() { ...
0
votes
0answers
8 views

meta_query works with single query but not multiple queries

This is very strange and I'm not sure why it is happening but this piece of code... $args = array( 'post_type' => 'property', 'sentance' => true, 'meta_query' => ...
0
votes
0answers
18 views

Sort Post by Author Meta Field?

Im trying to make a High Scores table. The scores are stored in the user profile as an author_meta. Im not having any problems getting the scores from the post, what I cant do is put them into an ...
0
votes
1answer
26 views

Array in meta key?

I have a custom post type called "conference". I want to create a specific meta key for users who have registered for the conference. For example the meta key slug would be registered_users which ...
0
votes
0answers
45 views

Multiple file inputs in array in theme options

Trying to add multiple file inputs to theme option settings. I'm having trouble with wp_handle_upload it's giving me this error array(1) { ["error"]=> array(1) { ["img"]=> int(0) ...
0
votes
1answer
47 views

Tax query array terms display out of order

I want my tax_query terms to display posts in the order I have them listed in the array below but it is not following the order listed. $args = array( 'post_type' => 'staff', ...
0
votes
2answers
51 views

Order posts with custom taxonomy array

I am trying to make my loop go through the posts that are associated with these terms. Currently nothing is being output. <?php $args = array( 'post_type' => 'staff', ...
0
votes
0answers
22 views

File input returns null in theme options array

Trying to work out a rather complex array situation with a theme options page. While working with file upload I can't seem to get it to work. Any idea what I might be missing? Simplified example ...
0
votes
0answers
16 views

How to put a select option in jigoshop checkout?

Am I doing the right thing guys? Please help me. What I want to happen is to put a shipping time in billing address. Help me please. Thanks array( 'type' => ...
1
vote
2answers
425 views

Make Selected Mutiselect Items “selected”

I'm developing a theme settings panel for a new wordpress theme that have an option to exclude categories from being shown in the loop. I managed to get the main functionality to work, using a ...
0
votes
1answer
29 views

How do I create a numbered list with PHP? [closed]

I'm having some difficulty functioning this morning! This isn't specifically WP (more PHP), but I think that it would benefit WP devs in the future, so I'm asking here. I'm trying to create a list ...
0
votes
1answer
21 views

Can't print out returned value

Function to return the meta value as per author. <?php function ac_author_score() { $userID = get_the_author_meta( 'ID' ); $query = array ( 'author' => $userID, ...
0
votes
0answers
55 views

How to get duplicate array count with custom post type

After printing array I am getting output like this: Array ( [0] => WP_Post Object ( [ID] => 8 [post_author] => 1 [post_date] => 2014-01-31 ...
0
votes
0answers
28 views

Wrong datatype for second argument error

I am getting a strange error on my Wordpress site. Does anybody know what is going on here? and how to fix this? The Error: Warning: in_array() [function.in-array]: Wrong datatype for second ...
0
votes
1answer
39 views

Get posts by list of post IDs ordered by those IDs?

I am going to make a "favourite" posts box, but the article id's are stored in another DB so I only get an array of IDs (which are relevant to the WP DB). I think it could be done with get_posts() or ...
0
votes
1answer
25 views

wpdb select from using array as search parameters

Similar to how you can insert into an array using code such as $wpdb->insert( $table_name, $inputs); //where inputs is an array I want to do a sql select statement with code such as ...
0
votes
1answer
50 views

Does meta_value (array) work with 'orderby'?

My goal here is to query posts by a meta_key, with the values falling in between 1-100. When pulled, it is suppose to be ordered by ascending starting from 1 to 100. $post = array( ...
0
votes
0answers
36 views

Adding line to multidimensional array option

I'm building a shipping plugin with a settings page where the user can add boxes with the attributes : Name, Length, Width, Height So far, I have managed to greate an option boxdata[l,w,h] and I have ...
0
votes
2answers
46 views

Create menu locations for each category in wordpress

I need display a special menu in each category page in wordpress, for example I have 3 category: horse,dog,cat So I must have 3 menu in Menu Settings locations with name: horse,dog,cat with this ...
0
votes
0answers
32 views

tax_query operator issue. IN works, AND never returns any results

This is a bit complicated. I have a wp_query that is almost working perfectly, but I have one issue. I think there is something here that I'm just not seeing. All of my code is an included php file ...
-1
votes
1answer
40 views

Extract array from custom field

I'm using woocommerce product bundles extension. I need to manipulate some informations about bundled post. Actually I found the bundled product container has a hidden custom field named _bundled_ids ...
0
votes
0answers
39 views

Using Advanced Custom Fields with Associative Arrays

So, I've got this conversion chart I'm working with, and have stored its values in a simple array, wherein it lists both UK and US sizes: $conversion = array( "2.5" => "1", "2.75" => ...
0
votes
1answer
758 views

Passing a variable into Contact Form 7

I have been looking for a solution to this, have seen some sort of add on called dynamic text but I don't think that suits my needs. Basically, I have a multi dimensional array. Basically what I want ...