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

0
votes
1answer
30 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
18 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
37 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
72 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
125 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
111 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
71 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
99 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
67 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 wpdb;...
0
votes
1answer
142 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
21 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
426 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](...
1
vote
1answer
46 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: $wp_customize-&...
0
votes
0answers
199 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
69 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( 'swcs-settings-...
0
votes
0answers
75 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
140 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
71 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
137 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
67 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
110 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
34 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
49 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
21 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
24 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: Body-...
0
votes
3answers
38 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 ...
3
votes
1answer
83 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) { ["post"]...
0
votes
1answer
116 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 '...
0
votes
0answers
39 views

Add custom filter to register data in array

I would like to register a multi arry of data in a plugin and allows any developper to add new value to the array. This multi array contains a name, and different value like this: class ...
0
votes
0answers
107 views

extract shortcode_atts with multiple meta key and meta value

I am trying to extract( shortcode_atts( array( arry with multiple meta key and value in bellow snippet code you can see that i am extracting shortcode_ats with bellow code '...
0
votes
0answers
34 views

How To Have An Array Accessible from anywhere on the site?

I want to have an array that is dynamic that is accessible from anywhere on the site. My reason for having this is not to run a database query. Example: We start with array('cat' => 1, 'dog' => 2) ...
2
votes
1answer
24 views

When and why should I use $wpdb different return types?

This one returns an object $mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = 10"); An associative array $mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE ...
0
votes
1answer
105 views

Page returning ID from array, how to return the correct values for post in acf wordpress

Im having a little trouble returning the correct value with the relationship field. My end result is to use the relationship field to add selected locations to a drop down in gravity forms. I can ...
0
votes
1answer
317 views

SOLVED - How can you query posts by advance custom field when the value is a serialized array?

Bottom for resolution Im going crazy I think. I cannot figure this out for the life of me. I have an advanced custom field that is a select box. The select box has multiple values and allows for multi-...
0
votes
1answer
391 views

Get html data with javascript to php array and store to wordpress database

What I wanted to do is get the items that are dropped to the droppable area and stored it a php array so that I can store into database so that I can access the stored array from other parts of my ...
0
votes
0answers
23 views

Include timestamp in a foreach array

Please forgive me for my ignorance and thank you to anyone who helps. I have a follow/unfollow plugin that stores the respective user ids using update_post_meta. I am now doing a foreach loops to ...
0
votes
0answers
33 views

Get wp_dropdown_users to set variable in page

I have a page my-bookings.php which is generated by Events Manager Pro Plugin. Is shows all bookings made for the logged in user. Great overview, but the same overview is not available for Admins and ...
0
votes
1answer
59 views

WP_Post is not from correct array

A bit of a complicated problem here, but I figured I'd see if I could get any help. My logic is this: WordPress custom post query > for each of the results, factor in distance (calculated separately)...
0
votes
1answer
79 views

Reformat data within a nested array

I have the nested array of data below which comes from the Wordpress Formidable Pro plugin form entries database table. I would like to reformat it so I can use it in a Wordpress WP_list_table but I ...
0
votes
0answers
57 views

I am not getting result from php function that is json encoded

So I am trying to build an array of post data. But when I json encoded it I am not getting back the post object data from the database. Here are my two functions public function get_post_from_url(){...
0
votes
1answer
35 views

Getting Category Children

i have a problem understanding the get_terms function All i want is getting all the children of specific category so that it can be listed. But i don't really know how the $args works. So with this ...
0
votes
1answer
121 views

Getting custom post types to properly display alphabetically

I'm trying to get the sub loop of custom post types to display in alphabetical order, but having no luck. I've tried applying ksort and asort to the $posts array, but it just reorders the ID display ...
1
vote
1answer
164 views

How to get update_post_meta output to include string length

I'm using the plugin WP All Import to import a special post type. The plugin includes an action hook pmxi_gallery_image that runs after the import that saves the attachment images to the post gallery. ...
4
votes
1answer
1k views

How can merge two arrays values in one array and save in database

I am working on WordPress upload meta fields. When user upload images the images are sized in two dimension one is "thumb" and one is "big" and they re sized very perfectly. I save both of images ...
0
votes
1answer
41 views

Dynamically generated Navigation Diagram using Custom Fields

I am attempting to dynamically generate a Navigation Diagram (as seen at http://zinderlaw.indigo-grove.com) that uses custom fields on the page to fill in the href tags of the imagemap. I am not ...
0
votes
1answer
86 views

CPT and metabox: create multi checkbox by using array?

I have a custom post type to display informations of book. Then I created a metabox for it. And: I need to add a warning system (like: for kid, violent, mature, adult, etc...) chosen by multi ...
0
votes
0answers
35 views

How to find the function which is outputting Array

I'm calling a plugin (Event Rocket) from a template and the output is mostly as expected but seldom the only thing that is displayed is "Array". I have consulted the plugin's makers and they have no ...
0
votes
1answer
64 views

how to query for meta_value have array

I have array in post_meta like this: array( 'option1' => 'true', 'option2' => 'true', 'option3' => 'false', option4' => 'true', 'option5' => 'false' ) and I would ...
-1
votes
2answers
75 views

Insert data into custom table from fetching $_POST values

I get this type of data using print_r() Array ( [0] => test [1] => raviradadiya.ommune-buyer@gmail.com [2] => 1.00 [3] => 21:16:36 Jun 04, 2015 PDT [4] => 9DS7592P74GMN ) Now I ...
0
votes
1answer
100 views

Can't add classes using jQuery from a JSON string with get_body_class()

In order to refresh the classes on the <body>element after an AJAX call, I am writing at the top of my AJAX response the following in JSON: $o[ 'classes' ] = get_body_class('project'); I can ...