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
4answers
393 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
0answers
22 views

-Advanced Custom Fields- Show the content only if the user is in an array [on hold]

this is a follow up from this question : Using a custom field value as current users name I opened a new thread because the question I'm asking is slightly different from the original.. I have used ...
2
votes
1answer
34 views

Autogenerate wordpress shortcodes using array?

I was create a shortcode which automatically generate shortcodes with given array key and value. Function names does not generate dynamically. Note: Array KEY = ShortcodeName and Value = Wordpress ...
0
votes
1answer
12 views

How to use an array of categories as a dropdown?

I need to use an array of existing categories as a dropdown option value then use the selected category ID. More exactly, I try to make a custom module to display the latest posts form selected ...
0
votes
2answers
27 views

how to store arrays into a database

I'm trying the store multiple rows into a database. The number of fields will change. Below is the way that I use to store just one row. <?php if(isset($_POST['save'])){ ...
0
votes
0answers
23 views

Meta-Box to add multiple items one at a time and on publish save all

My example custom content type is for recipes. There will be a meta-box for ingredients. In this meta-box there will be three attributes and a "add" button. Name Measurements Notes Add Button My ...
1
vote
1answer
26 views

How pass a 0 in $atts?

I need to pass an attribute (tabindex="0") into my navigation link. I use this filter: /** * Add tabindex attribute to menu links * * Brings keyboard accessibility for opera browser. */ ...
1
vote
1answer
39 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
33 views

using array in wordpress database query

I have a strange situation, i'm working on wordpress website and creating a export plugin. On one page i have products name with checkbox and once i select few and submit it pass the value to next ...
0
votes
1answer
467 views

Build Array from Input Fields question

I have a series of input fields sets: <input type="text" name="people[name]" /> <input type="text" name="people[lastname]" /> <input type="text" name="people[email]" /> <input ...
0
votes
1answer
265 views

Multiple entries in get_option results? or why is _multiwidget set to 1?

I am developing a wordpress widget, and need to store some user configuration values, that is why I am using wordpress update_option and get_option. I am new to widget development. I have some ...
0
votes
0answers
26 views

update user meta with multidimensional associative array

I am trying to: If a key exists If inner key exists Update value Else, Create key and populate with value Else, Create key and populate with value(inner array) ...
2
votes
2answers
250 views

Save custom post type in different table

I need to store custom post type post data into a custom table, not in wp_posts and wp_postmeta. Is it possible? anyone help please. Actually, I have created two custom post type named "truck" and ...
0
votes
1answer
50 views

How to get values from wordpress listings and use them in javascript array?

I'm trying to get values (latitude, longitude and an image) from the WordPress database and put it into a javascript array. Unfortunately I'm a newbie at Javascript and PHP! Here is the code I have ...
1
vote
2answers
39 views

Wordpress: How to use post_class() in an echo

I am working on a foreach loop in Wordpress and want to add 'post_class()' to a div within it. Currently the code looks like this: if ( is_array( $posts ) && !empty( $posts ) ) { echo ...
0
votes
1answer
30 views

Array to modify post titles

Could this be converted into an array: function manipulate_post_title($title){ global $post; if ($post->ID == 1) {$title = $title.'suffix';} if ($post->ID == 2) {$title = ...
0
votes
1answer
57 views

Repeatable field within repeatable group of fields

Compounding on Saving metabox repeatable fields ... I've created a metabox with a series of fields that are repeatable. However, within those fields, I'd like to create another field named Choices ...
-3
votes
1answer
22 views

Retrieve Array from within Array [closed]

I have an array being created within another array in Wordpress and I need to get the ID value from each Array. This is the code I am using to pull the array <?php $pages = get_field('products'); ...
0
votes
1answer
22 views

Echo only gives me the first part of string

So I was pulling some meta_value and trying to use it in a mass email and tested it first by echoing what I obtain in the array. In var_dump I see the array and that it gets my correct data, but when ...
0
votes
0answers
19 views

Wrap URL around custom field checkbox array

I have a custom field of checkboxes for choosing an "Area of Expertise" that was created using WCK (WordPress Creation Kit which I'm using to create CPTs and Custom Fields). I don't know if this is ...
0
votes
1answer
129 views

Multiple User-Meta Values in One User-Meta Key

Currently, I am adding user metadata with the key position_name and a string value representing a user's position, such that I can retrieve a user's position by way of a call similar to: $position = ...
0
votes
1answer
47 views

post__in works but also prints the word Array

First line of the code below carries post ids captured via a form. Then rest of the code helps pull the post-thumbnail of the respective post ids $sel_ids = $_SESSION['selected_ids']; if ( ! ...
0
votes
2answers
299 views

Create Array from custom post type to display a slider

I have created a custom post type in my wordpress theme dedicated to creating slides for a slider displayed on the homepage, It has a title, slide text and slide url and also featured image. I'm now ...
0
votes
0answers
12 views

get current taxonomy term to populate an array

I use this in a page template, I am hoping for a solution to filling in the 'XXXXX' space with the current term selected of the taxonomy 'place'. I don't think i can do_shortcode within an array. ...
0
votes
1answer
64 views

Get the values from an array string to work with post__in

Basically i need help to build a proper array to pass as value of post__in Basically code has to get featured images of posts only for selected ids. I need your help to extract the values of ...
1
vote
1answer
109 views

How can I get an array of all IDs from the current queried object?

I am trying to join an array of post IDs together. Right now, it seems my code is creating a separate array for each ID, instead of one array with each ID. This is the code that I have come up with. ...
0
votes
1answer
25 views

Get current user array into hyperlink

I am unsure how to take data from the user array and place some of these values into the following hyperlink. I want to replace the email address, first name and last name with the values from the ...
0
votes
2answers
35 views

Grouping posts by a custom meta value

I'm trying to output a list of dates that are held in a meta key called event_dates without duplicates. I've also tried a wp_query with a meta_compare but I'm not able to make that work either. Any ...
0
votes
1answer
187 views

ACF checkbox array is returning numbers, not labels [closed]

I am using Advanced Custom Fields and the add-on Repeater to create a field in the admin through which a user can select multiple icons. Each icon has an associated label, and I'm trying to return the ...
0
votes
0answers
58 views

WP Query posts__in not working with array

I am using the following code to generate a specific list of posts with WP_Query $args = array ( 'post__in' => $cookie_array, 'post_type' => 'tyre', 'post_status' => ...
0
votes
1answer
341 views

Metabox repeating fields - 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
1answer
101 views

I need to exclude from a query a category and a few custom taxonomies

I need to exclude from a query a category and a few custom taxonomies. Is this code right? This query don't exclude any post, the one with the category, or the custom taxonomy. What am I doing wrong? ...
1
vote
2answers
346 views

How do I search an array stored in a custom-field using WP_Query?

I have a custom post type called "on-air" that included a custom-field called "daysonair". The form for this has checkboxes for each day of the week. When you add/update a post, the checked items ...
0
votes
1answer
119 views

Get current user array with post string

I need to get 10 current user fields and pass the field values to a post string. The post string is expecting certain label names for each value. Example - post string expects 'firstname' => ...
1
vote
0answers
98 views

How to save double quotes in post meta, when the post meta data is an array? [closed]

Ok so I've been scratching my head on this one for a while. I'm making a plugin that adds a custom meta box to a custom post type. I'm using the update_post_meta function to save the data from the ...
0
votes
1answer
24 views

Pulling posts tagged with similar title name

I'm trying to pull in posts in a page that are tagged with the same page title. For example, if the page is called Banana Pants, then I can call all associated posts manually like this: <?php ...
0
votes
1answer
53 views

Adapting a php array to WordPress

The guys over at the other Stackoverflow said I should post this here. I've been reading and tweaking code for three days and can't figure this out, because I'm new to php. The developer that wrote ...
0
votes
0answers
16 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
79 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
82 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
660 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', ...
2
votes
2answers
183 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
15 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
1answer
82 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
60 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
986 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
41 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
72 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
166 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
149 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 ), ...