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

3
votes
2answers
386 views

How do I pass an array as an argument to a WP-CLI command?

I want to use WP-CLI to create some new posts with custom taxonomy terms assigned. The challenge is that wp_insert_post's tax_input argument only accepts arrays, which I would have to specify on the ...
0
votes
1answer
467 views

Display custom posts in checkbox list

I am working in a WordPress backend design and I would like to know if is there any function like wp_categories_checklist but for posts. I have an issue here: ...
0
votes
1answer
187 views

using images in next/previous_post_link [closed]

In my blog's pagination section, I've used <?php previous_post_link(); ?> and <?php next_post_link(); ?> to generate the newer and older posts links. Within that action, though, I've ...
0
votes
1answer
71 views

Turn get_posts as string into an array for use in theme admin options

I am trying to add a drop down list of all posts into a theme admin section...without forklifting the theme code. I need to pass the post title and id into the 'options'=>array() like so: ...
0
votes
1answer
29 views

Get user_meta values for a user for an array of meta_keys?

I would like to retrieve the meta_values for an array of meta_keys for a user. Is there a function in WordPress core that offers this functionality? Something that would work like this: ...
0
votes
1answer
139 views

Meta value Array

I am hoping someone can help me out. I have created a custom meta box and trying to store an array, but when using update_post_meta, it doesn't seem to be storing it as an array. I am getting the ...
2
votes
1answer
442 views

Formatting of curly brackets array from WP database to get more readable output

E.g. when I want to edit something in my WP database, I get a headache, literally. Because I see something like this: ...
1
vote
3answers
956 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
48 views

Matching usermeta at registration to categories of content

I'm trying to connect some user_meta data from registration form to some categories set up in admin to filter the presentation on the page. This one is tripping me up because the question has multiple ...
0
votes
1answer
76 views

Get custom_user meta value and add entry

I created a custom user meat value and want to add a new key/value to this array. But somehow I can't get it to work correctly, I always get a new array in side the array so that I always have e new ...
0
votes
1answer
544 views

Exclude a 'portfolio' custom category?

I have a custom post type called 'portcat' and I want to exclude one portcat category ('weather' - ID='5') from the page. I've tried 'category__not_in' => array( 5 ) but apparently this doesn't work ...
1
vote
1answer
200 views

get_the_tags() not iterating through for/while loop, but will with foreach

I'm having a very peculiar issue with Wordpress right now that I can't understand, and hopefully someone here will have experience with it to help solve it. I'm trying to iterate through the array ...
0
votes
0answers
98 views

Why is $_POST Empty in Profile Edit Admin?

This is a very odd problem - post data seems to be empty in the profile editing page of admin. Here is my code: http://pastebin.com/3ejg8P99 What causes this? Is there some "safety" step I've missed ...
1
vote
1answer
293 views

How to save data of an input field to an array

I'm writing a plugin to edit my profile page. How can I save data of an input field to the database and then display it? This is my code. The first part is the display in HTML: <form method ...
0
votes
0answers
23 views

How do I retrieve a value from a multi - dimensional array using get_post_meta? [duplicate]

I know that I need to use get_post_meta(31, $custom_repeatable, true); The post_id is 31 and the meta_value is $custom_repeatable. I would like to display the value hamsters repeat one only . My ...
-1
votes
1answer
153 views

How do I just display the part of the array that I want to? [closed]

I would like to take a stored array, from the meta_value $custom_repeatable and just display the line 'hamsters repeat one', but the following code doesn't display it how I'd like. Here is the code: ...
-2
votes
1answer
830 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
1answer
64 views

Get specific custom field keys from a post and put into an array

I have the following code to look up the longitude and latitude based off of a custom field upon saving the post. My address fields (street_1, city and state) are separate. I have searched and thought ...
1
vote
1answer
141 views

Resort get_categories

I have a get_categories array $args=array( 'orderby' => 'id', 'order' => 'ASC', 'taxonomy' => 'wpsc-variation', 'hierarchical' => 1, 'hide_empty' => 0 ); ...
0
votes
0answers
330 views

How do I retrieve an array from wp_postmeta with get_post_meta?

I have got an array stored in the wp_postmeta table. It is has a meta_key of custom_repeatable It has a post_id of 6. How do I retrieve this & echo it? I think I have to use the following, but ...
1
vote
1answer
149 views

My theme saves their custom post type's metadata as a serialized array, how to access the keys?

I've recently bought the WP Directory Portal theme from ThemeForest. Since the theme doesn't do frontend posting of custom post types, I've resulted to using WP User Frontend Pro. There's a problem ...
5
votes
1answer
2k views

How to store widget fields data as an array?

I am creating a widget, it needs to store about 10 IDs. Right now I'm using following field method to store each of the ID in a separate field. It stores data of each field in a separately in the ...
0
votes
1answer
208 views

update_user_meta duplicates entry

I have a very simple code in my themes footer if (is_user_logged_in()) { $user = wp_get_current_user(); $aka2 = get_user_meta($user->ID, 'last_visited_blogs', true); $aka2[] = 'blog4'; ...
0
votes
2answers
808 views

How to create a multidimensional array with multiple loops

I have this loop where I loop through every post of my CPT and fetch the title and the content of each post and put it into an array. That is no problem. But as it happens I have created a repeatable ...
4
votes
1answer
338 views

How can I save an array from a random post sequence for later use?

I'm building a random workout generator on Wordpress to help with my fitness, and am stuck at saving random post arrays for later reference. I'll explain. The generator should work in two main ...
-1
votes
1answer
1k views

Output dropdown results into Woocommerce Order details

How do I correctly get the data from a drop down (select) output into the Woocommerce Order Details section of the admin? When I do this, I get an output for all my text box questions, but nothing ...
0
votes
1answer
327 views

Finding and removing duplicates within WP Arrays

I'm looking to see if it's possible to find and remove duplicates from the arrays generated below. I've tried array_unique array_merge and they haven't worked. $category = get_the_category(); $tags ...
0
votes
1answer
82 views

get_permalink returning first letter

I'm trying to use an ajax function in my custom template to retrieve a post's custom fields to show a post overview. Getting the custom fields is working, but the getting the permalink isn't. I'm ...
1
vote
1answer
300 views

How to validate register settings array

I would like to know how to perform a proper validation with the register_setting() callback function. Here is a sample part of my code I want to work with: register_setting( 'wpPart_options', ...
0
votes
1answer
168 views

get a simple array of all of the term names that exist in all taxonomies

I may be going about this all wrong but I'm trying to use get terms to get all of the terms that exist in every taxonomy. I think this might be a php question. get_terms allows you to specify which ...
1
vote
2answers
5k views

Defining a global array in functions.php?

I try to create an array of years, which is avaible in my template-files and in at least one other function in the functions.php. function get_the_years() { global $year_arr = range(2001, ...
0
votes
1answer
118 views

Multidimensional array sort?

If i have a set of years, retrieved by the loop, for every years can be more post ID. Like: 2008 => 3,7,8 2009 => 4,5,6 2010 => 9 the code is: ...
-1
votes
1answer
388 views

How do I find the first item in the post array?

I left ????? where I need the answer. <?php global $post; $the_post_ID = $post->ID; $n = get_posts(); ?> <?php foreach ( $n as $post ) : ?> <nav id="postNav"> <ul> ...
1
vote
1answer
375 views

How to use shortcode attribute in separate function

I'm working on a WordPress site and have installed a slider plugin that registers a slider on the backend (or multiple sliders) and then displays it on the front end with a couple of simple php ...
0
votes
1answer
144 views

shortcodes inside shortcode to sum values

I have statistical shortcodes that return values [stat1 val="usa"] [stat2 val="europe"] [stat3 val="china"] [stat4 val="africa"] I struggle to create the shortcode that can sum the shortcode values ...
0
votes
1answer
111 views

Shortcodes and a list of IDs?

I'm creating a simple shortcode function and need to specify a list of IDs as a variable. I've checked the Codex but I'm not sure how this is handled. The shortcode is: [video_vote ...
0
votes
1answer
78 views

posting twice from an array?

I dynamically create iterations of a form field with jquery, but they all carry the name extrakosten[] for the first variable and the other variable vergoeding[]. The php: $postTitle = ''; // save ...
0
votes
1answer
58 views

Adding Category Argument into an Array for WordPress Query

I'm new to customizing WordPress and am looking to query an array of posts within a certain category. I have a display that's showing an array of all posts from the site: $arguments = array( ...
1
vote
2answers
1k views

shortcode to create dynamic dropdown box form shortcode attributes

I am trying to make a shortcode that will create a dynamic dropdown list of downloadable file links, that once selected, html will show a download link below the dropdown. Here is the end result of ...
0
votes
1answer
236 views

Insert dynamic content into posts

I'm currently using this plugin http://wordpress.org/extend/plugins/automatic-featured-image-posts/ which creates batches of posts from uploaded images I'm also using this code here to generate the ...
0
votes
2answers
190 views

create functions based on array values

I am working on a function set that will add a piece to each custom post type on a site. Since I won't know what CPTs are registered, I wrote a function to get them all (simple). However, I now need ...
2
votes
1answer
1k views

Problem with wp_update_post

I'm trying to write a plugin that creates a page if a box is checked (value 1) and if the post id doesn't already exist. If the post id does already exist, then I want to update the post with whatever ...
-1
votes
1answer
117 views

Use php array outside his function

any ideas why my function print_r $arr with lot of elements, but only retain cat and dog when it comes to print_r $stack? I need to have $arr used outside the function, function ...
1
vote
1answer
295 views

Save an array from drop-down in custom meta box

I have successfully pulled a custom post type through into a drop-down that is in a custom meta box. However, when displaying it on the front end I would like to also provide a link to the actual ...
1
vote
2answers
560 views

Limit the post for differents custom post type in the same wp_query

I have three custom post type: books magazine videos Now i want to limit the number of post for custom post type, for example: books => 3 post magazine => 2 post videos => 1 post I used a ...
1
vote
0answers
19 views

How to write an efficient metabox with repetitive fields [duplicate]

Possible Duplicate: Create more Meta Boxes as needed I’m having a hard time to write an efficient code for the below Metabox. Since I do not want to use any third-party class, I’m trying to ...
0
votes
1answer
91 views

Ways of dealing with nested arrays within option

I stumbled upon one problem regarding too complicated(at least in my point of view) data structures stored in option field. Right now I have an array of collections and within each other there is ...
-1
votes
1answer
66 views

Marketpress php warning on server, no problem on localhost [closed]

I have this in my functions.php that creates a shopping cart widget with the plugin Marketpress. <?php function marketpress_get_cart_subtotal($format_currency=true) { global $mp; ...
0
votes
1answer
353 views

Using multiple variables to assign categories to an array

I have php set up in a template file to check a form and see if 1 or more of 5 categories is selected. Based on which one is selected, I want the custom query I'm using to change in that the array for ...
1
vote
1answer
87 views

How do I get link URLs from the Wordpress links backend into an array?

I'm currently running a blogroll on a site I'm working on by defining a variable with an array that has all the rss feed urls I want to pull from. Like this for example: <?php // Get RSS Feed(s) ...