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
votes
0answers
15 views

ACF Front-end Form Storing/Fetching Post Meta Array Field Values Via Repeater

We're using the acf_form() function to update a custom post type on the front-end. So far, your plugin is working absolutely brilliantly (truly impressive and a great plugin). We are getting stuck on ...
0
votes
2answers
25 views

Call global variable array() in woocommerce child/template

So I have this in my functions file - it defines the products that are not eligible for free shipping. It works everything is fine. //functions.php function my_free_shipping( $is_available ) { ...
-1
votes
0answers
17 views

'Gravity Forms + Custom Post Types' plugin map Multiple Fields Into one meta_key field as array values

we're using Gravity Wiz's awesome plugin 'Gravity Forms + Custom Post Types' plugin. Specifically, we're using this as a way to provide front end custom post type creation/editing on the front-end for ...
0
votes
1answer
21 views

Struggling with array and foreach loop

I have a function that outputs an array with 2 objects(?): Array ( [de] => 166 [it] => 167 ) Where [xx] is de language code and the number is the pageID. I'm having a meltdown in my brain as I ...
0
votes
0answers
27 views

Update post meta does not serialize array

For some reason my update_post_meta() function does not accept an array. Normally the function serializes the array by itself, but now I need to do this by myself, otherwise it does not update. Could ...
0
votes
0answers
22 views

Order char by post title

This is my code: $args = array( 'post_type' => 'post', 'orderby' => 'post_title', 'order' => 'DESC', 'posts_per_page' => 15, 'tax_query' => array( array( ...
0
votes
1answer
43 views

Dynamically adding filters

I have a function that I'm trying to get an array in it to use in a callback to dynamically add filters. Here is the function that I need to retrieve the array keys from ( in the $classes variable ): ...
2
votes
2answers
74 views

List of posts by day of the week

I have Radio with programs and they are associated to day of the weak. Example: 1-Program Disco Nights plays at Monday and Friday 2-Pragram Crazy weekends play only at Sunday 3-etc 4-etc ...
0
votes
1answer
31 views

How to use json_decode a post_meta value? [duplicate]

I have used get_post_meta($post->ID) to get all custom fields for my post since I have many of htem. Some of them were checkbox values and var_dumping the variable gives me this array (size=1) 0 ...
0
votes
1answer
32 views

Plugin Shortcode value in post

Theme was output with function get_post_meta(get_the_ID(), 'some_value', true); when I try with die(print_r()); function there have some array containing values such as [item_ticket_tailor] => ...
1
vote
1answer
26 views

Checking array against author id in loop

So I have a function in Wordpress with a plugin that returns a list of friends as an array. The function code is here: function friends_get_list($tmp_uid, $friend_status=1) { global $wpdb; ...
-1
votes
1answer
52 views

Warning: array_map(): Argument #2 should be an array in

So there is a an error message that keeps popping up on most of the pages in the front end. The error says Warning: array_map(): Argument #2 should be an array in ...
3
votes
1answer
37 views

Get_term_by only returns one item from array

I am trying to retreive a term id based on the term name using the "get_term_by" function that is build into Wordpress. However, this function only retrieves one item from the array that i get them ...
1
vote
2answers
34 views

Must Use Plugin Causing Query Error

I created an MU Plugin which will only display the posts from certain tags in the loop like this: function custom_tags( $query ) { $query->set( 'tag', array( 'custom', 'general' ) ); } ...
0
votes
1answer
74 views

Combine results of multiple WP_Query to resemble single WP_Query

This is the code I've been using, with the preceding query parameters excluded for brevity. As you can see, this comes from a widget that displays a grid of posts. The problem is that I can't figure ...
1
vote
1answer
56 views

get_post_type() in in_array doesn't work for some reason

I am trying to create some function for metaboxes and some reason i can't get get_post_type to work in in_array. Everything else seems to work in testing but in_array nope. This is the function that ...
0
votes
1answer
40 views

Order a WP_Query by meta value where the value is an array

I have a WordPress custom query: $args = array( 'posts_per_page' => 2, 'meta_key' => 'pworks_popular_posts', 'paged' => $page_nr ); $query = new WP_Query($args); ...
0
votes
1answer
46 views

Error in WP_update_post

i make php file outside from wordpress folder to edit wordpress post and i get error when i use this code. wp_update_post <?php include '/go1/wp-includes/post.php';?> <?php // Update post ...
0
votes
1answer
15 views

WP_Query with page_ids in arguments without a result

I want to get some pages with WP_Query: $resume_args = array(); $resume_args['post_type'] = 'resume'; $resume_args['posts_per_page'] = -1; //$resume_args['page_id'] = array(9046, 9346); //No ...
0
votes
0answers
22 views

WP_Query: Meta_Query with serialized value (or a workaround)

I have a post type Issue, that has meta values in form of associative arrays (that are saved as serialized strings to database). They look somewhat similar to this: [article_reviews] => Array ...
0
votes
1answer
55 views

Show one post per author and limit query to 8 posts

I want to show 8 recent products from multiple authors on the frontpage. Need to show 1 recent product per author. Currently i'm using basic wp query to show recent 8 products. $args = array ( ...
0
votes
2answers
29 views

Should I store arrays in custom fields or create custom tables?

I am developing a website where I have modified the comment form to have review rating capabilities. I ask them to rate them on food, service and location. For each of those option there is ...
0
votes
1answer
19 views

Array is not working in Filter?

This doest not works: Warning: in_array() expects parameter 2 to be array, null given $non_area_page = array(160951,160955); // This does not work add_filter( 'term_link',change_term_name , 10, ...
0
votes
0answers
13 views

How to use a variable as key in an array at Customizer select setting

I'm trying to add a Customizer 'select' setting to my theme with the path to a CSS file as key in an array, like so: $wp_customize->add_control( 'control_something', array( 'label' ...
0
votes
1answer
31 views

Custom Post Type Field Array parsing [closed]

I have a CPT Field named 'course_location' as a checkbox with values. When I use $field = get_field_object('course_location'); '<pre>searchDateArray'; print_r($field); echo '</pre>'; ...
0
votes
1answer
34 views

wp_generate_attachment_metadata for non-images files

I created a frontend form for upload images and worked fine. The only problem is that I need generate attachment metadata for non images file. Now, metadata is only created for images files. I'm ...
0
votes
1answer
46 views

Need to echo category id in multi-dimensional array

I have custom post types and categories created with the Types plugin. I have category images allowed/created with the Categories Images plugin. I have a loop that displays the posts of a category ...
0
votes
1answer
49 views

Query Custom Post Types with checkboxes

I have Custom Post Type (Courses) with a field "course-location" that is a checkbox. I would like to filter the listing page with the checked items. The below code is working when I select ONE ...
0
votes
1answer
41 views

how to remove/exclude html coding from json file while export?

I have created a file using json and exported it. Its creating HTML tags with it. Actually,I don't want to have that html part to be there in the file. Below I am sharing structure of my current file: ...
1
vote
1answer
45 views

meta_query issue with multiple numerics

I'm having an issue with a search form. I basically have 7 input fields used to search different properties. All of them apart from the last two see to be working, as soon as I introduce the last two ...
0
votes
0answers
25 views

Display result from custom post meta query

This is driving me crazy! I'm trying to simply echo the contents of a meta field (twitter) from the wp_postmeta table of a custom post type with the following query outside of the loop : global ...
0
votes
1answer
68 views

Extracting Distance from FacetWP Proximity Function to Display in Wordpress Template

I am quite new to Wordpress & Php coding in general, I have a relatively simple theme that I have been working with that contains a custom post type that stores latitude and longitude. Each post ...
0
votes
1answer
18 views

Show certain number of post from tags

Hi i am using the query below to display post from a certain tag term, but what I want it to show multiple post. So far the query is displaying only 1 <?php $args = array('tag_slug__and' => ...
4
votes
2answers
210 views

When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?

When adding arrays to post meta, using add_post_meta, new sub-arrays are added. I was wondering if there was a way to have those sub-arrays named. so instead of ending up with array([0](2,3), ...
1
vote
1answer
23 views

Customizer Settings in Arrays

Good afternoon. I'm using the theme customizer to allow the user to select which pages to show the excerpt of on the front page. I've done this by using an array in the setting name: ...
0
votes
0answers
74 views

Display custom post type AND posts from a certain category

As the topic says I want to show posts from one category (band-news) and posts from a custom post type (artist) in the same loop. I got this but as you can see it want do as I wish: <?php $posts ...
0
votes
1answer
45 views

Adding option values as an array using a multi selectable select box

I have a plugin I'm developing. As part of its functionality I need to set up an option group and specify an option var for that group: function swcs_settings() { register_setting( ...
0
votes
0answers
44 views

Custom post type pagination page 2 404 error

Sorry to repost this but I haven't found a solution to my problem. I registered a custom post type instructor-emails and when I try to make the archive one post per page, the other pages return a 404 ...
0
votes
3answers
101 views

Get array of metakey in all posts

My posts contain a meta-field that holds an external id. I'm trying to create a function with a loop that goes through all posts and puts all the meta-keys in an array and returns this array. This ...
0
votes
1answer
59 views

How to put an array in wp user query

I am quite new to php and wordpress developement, and I am also new to this website. I want to learn development by trial and error. Please forgive me if i don't use all proper terminology. I have ...
1
vote
2answers
88 views

How to check a single number value against an array of meta_key values?

There seems to be a ton of information on checking a meta_key against an array of meta_values, but I want to do the opposite. I have a site with projects, and press reviews. When the client adds a ...
0
votes
1answer
43 views

Related Posts Excluding Certain Categories

I'm using a related posts PHP WordPress query, but having trouble excluding categories. I've tried excluding via cat and category__not_in as well as both as and not as an array. What am I setting up ...
0
votes
1answer
53 views

Trying to get custom post type attachment images to function in indexed array

I’m trying to display the first three attachment images in each post of a custom post type separately. I believe what I am looking for is a way to put the custom post type attachments into an indexed ...
1
vote
1answer
30 views

Storing Array from returned database query and using the array in a new query

I'm currently storing results in a variable from a db table like this : $followed = $wpdb->get_results("SELECT user_id1 FROM wp_um_followers WHERE user_id2 = 1", ARRAY_A); This returns an array ...
0
votes
2answers
46 views

How do I turn these values from MYSQL into an array

I am working on a custom query to show a few posts. I am able to output all the post ID's. I am trying to turn these ID's into an array so I can use 'post__in' => $myarray in my query. How can ...
0
votes
0answers
19 views

Array or Database

I have a question concerning the storage of variables. For my website I would like to add fields for education to the profile of users. To promote uniformity I would like that every user picks from ...
0
votes
0answers
17 views

$wpdb->get_var not matching after first loop through foreach

I'm trying to match my array with a entries in a table and retrieving the ID of the entry. So I have the following array called $features. Array ( [0] => Body Side Moldings: ...
0
votes
3answers
34 views

Need help getting a certain value out of a multi dimensional array

I'm looking to retrieve a specific meta value for users from the Wordpress types plugin. I know the value is stored in a wpcf-team-experience-member-type. This is a checkbox option and I'd like to ...
2
votes
0answers
54 views

JSON not valid after json_encode posts

I'm having problems saving JSON in a custom table in my database. I pull some posts (+ connected posts) from the database and add them to an array. This is a part of my array: array(2) { ...
0
votes
1answer
85 views

query_posts with meta_value

I have category 'news' http://localhost/foldername/news, for each 'news' posts I have custom field called 'years' and is set up as a Text Field. I have 2 values assigned n different posts '2013' and ...