The server-side programming language that the WordPress core, plugins and themes are written in.

learn more… | top users | synonyms (1)

5
votes
0answers
1k views

$wpdb->get_results(…) returns empty array despite correct query

As title implies, I cannot seem to get $wpdb->get_results to give results. Running the "raw" query is successful, but this seems to be failing for some strange unknown reason. global $wpdb; ...
3
votes
0answers
38 views

Efficient coding: how to keep track of function stack?

I've written a plugin that calculates how much server time is required for each function in a theme or plugin. The idea is it will encourage developers to write efficient and green code. If you want ...
2
votes
0answers
36 views

category_name not working (not showing up in sql query debug)

My plugin has a shortcode and it retrieves animals. There are filters/arguments and they all work well except the category argument or parameter. The category name(s) is/are well passed to my ...
2
votes
0answers
126 views

Cropping, Re-sizing and Saving images from one folder to another folder in wordpress

I'm adding an upgrade for the WordPress plugin which I have developed ages ago. This plugin is just a product catalog, so just show products and their images. Products can have more than one images. ...
2
votes
0answers
5k views

How to use update and delete query in wordpress

First i write manually update, delete, insert and select query and execute data with mysql_query function Like this: Select query $prefix = $wpdb->prefix; $postSql = "SELECT DISTINCT post_id ...
2
votes
0answers
213 views

Making a follow button, Ajax not talking to php

I'm trying to make a user follow button using AJAX, but for some reason my AJAX isn't talking to my jk_user_follow function and setting the wp_set_object_terms. PHP function ...
2
votes
0answers
52 views

Adding Field to Profile “Name”

I am trying to add an extra field or two underneath the "Name" or "About" section in the Wordpress user profile. So far I have only been able to accomplish this by: //Begin ...
2
votes
0answers
769 views

How to resize image on client-side before upload?

I've been using Plupload to resize images on the client side before uploading them to the server. I've implemented a front-end form which lets the user select a file from their computer and submit it. ...
2
votes
0answers
1k views

Should I use spl_autoload_register() in my plugin?

When I use spl_autoload_register in my plugin, I get: Fatal error: Uncaught exception 'LogicException' with message 'Class wp_atom_server could not be loaded' ...
2
votes
0answers
1k views

How to set a custom path, for ajax image upload folder in admin?

I am coding my first Wordpress plugin that handles some data for a custom (shop-like) post type. It also has an image uploader within a metabox, where you simply drag in your images and it ...
2
votes
0answers
453 views

Display a query with multiple post types and same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback in Wordpress. I have two custom post types called "Clients" and "Projects" and they each pull information ...
2
votes
0answers
284 views

Inconsistent temporary 404s on whole install | PHP error with post-template.php

I'm deeply confused by this one: I have a WordPress install on a Media Temple GS [one of many which work fine and are configured almost exactly the same] which is occasionally giving me 404s sitewide. ...
2
votes
0answers
1k views

How can I save a multiple select array with the settings API for a plug-in options page?

I'm thinking this may be more of a problem with my PHP rather than my use of the settings API, but I can't seem to get Wordpress to save an array of data for a multi-select box. The multi-select box ...
2
votes
0answers
529 views

Adding dropdowns to the tinyMCE editor

I'm new to php and wordpress but I've managed to figure out both pretty easily thanks to the community, forums and blogs. I'm close to figuring out what i want to do here, but wasted hours without ...
1
vote
0answers
3 views

wp_handle_upload_prefilter valid date from input file

I want to ask some help, i'm having problem with thewp_handle_upload_prefilter Here is the code: add_filter('wp_handle_upload_prefilter','mdu_validate_image_size'); function mdu_validate_image_size( ...
1
vote
0answers
27 views

Dynamically add styles to WP TinyMCE editor

I want to add custom styles to Wordpress using dynamic arrays. My question is how can I add the two arrays to the style_formats array within the 'my_mce_before_init_insert_formats' function ...
1
vote
0answers
14 views

wp attempt focus, disabling without touching core

So i've added an extra field to the login form. I have used js to place it at the top. However, whatever I do I don't seem to be able to change the tabindex(or start focus for that matter. Is there a ...
1
vote
0answers
36 views

Can I check plugins and themes for PHP 5.6 ahead of global PHP server Update

My server is updating to PHP 5.6 next week. I manage about 30 WordPress websites. I looked for a plugin that would check if any of the code throughout the other plugins and theme would break with the ...
1
vote
0answers
102 views

PHP array to JS array to use in google map

Hi I want to use some data stored in a php array to use it in google map api, to populate multiple locations in a the map. I use the loop to create my php array. <?php while ( ...
1
vote
0answers
17 views

When to use Exceptions vs Error Objects vs just plain false/null

I'm in the process of writing a plugin and I'm trying to gauge when to use different approaches of handling errors. There are three methods I'm considering: Throwing an Exception (custom class) ...
1
vote
0answers
28 views

How to append element after thumbnail

Hey I just wanted to know how to add an element after the first thumbnail image in my loop. Basically I want an HTML div tag inserted after the first image in my post. Anyone know how to do that in ...
1
vote
0answers
82 views

Passing jQuery value using Ajax to a page template

I have the following jQuery code:- jQuery('.fancymember').on('click', function() { var member = jQuery(this).parent('div').parent('div').find('.test').val(); var dataString = 'member='+ ...
1
vote
0answers
25 views

Dot is not added at the end of href

My Key is $P$BeVBjO.GF/Ngju8PCjKJgjV68buIgo. so you can see a dot at the end of my key Input: esc_url( add_query_arg( array( 'loginName' => $requestedUserLogin, 'key' => **$key** ), ...
1
vote
0answers
14 views

comments sorting incorrectly across multiple pages

This is a related_comments.php file which should display comments on certain pages in ascending order while the newest comment should be at the top. This is working fine if there is only one page for ...
1
vote
0answers
38 views

Position banner to right of logo in header - messed up my header file

Hi I made a mistake by editing my header.php file before backing it up and now having trouble getting it right. There's just a <div> tag missing or something but I am spinning my wheels so maybe ...
1
vote
0answers
25 views

Adding a widget function into the php theme file

I am using the following plugin - widget No Cache AJAX Widgets to display on the sidebar a feed of rss news that is created dynamically and bypassing the cache function. In updating the site we wish ...
1
vote
0answers
83 views

Displaying recent posts on static page with template-part via shortcode

So, I'm taking my first shot at creating my own custom Wordpress theme with Underscores. I have everything straightened out, with the exception of one last thing I want to add. I would like to add a ...
1
vote
0answers
46 views

Update user profile information from functions.php

I have the following function in my functions.php file:- function apply_for_job() { $job_id = $_GET['job_id']; $user_id = get_current_user_id(); $prev_value = get_field('applied_jobs'); ...
1
vote
0answers
10 views

auto-populating custom nav with all items from custom post type

I have written the following code to take all of the posts in my custom post type "products" (created with ACF) and inject them each as an <li> in a custom nav menu. Everything is working ...
1
vote
0answers
28 views

add_action shortcut?

I think in PHP 5.4 or above (don't remember the exact version), instead of writing: function some_function() { } add_action( 'init', 'some_function' ); One can pass an anonymous function: ...
1
vote
0answers
56 views

PhantomJS with wordpress

I know it sounds basic but I'd really appreciate some help/guidence on how to use phantomjs on my wordpress project. I'm using Windows 8.1 and local host with xampp for now. I've downloaded phantomjs ...
1
vote
0answers
34 views

Dynamically change feature image in customiser

For this client's Website I am making on their homepage there is a section called featured products with images showing off the product. Currently I have to update these images manually through my ...
1
vote
0answers
42 views

WordPress Quick Question . How to Get Parent Link in Submenu in My Code

I'm creating a menu walker from foundation 6 but problem is parent link is not click able, so solution might be that if we can get parent link in submenu but have some problem because I'm don't know ...
1
vote
0answers
37 views

Get the date of the className or classID

Is it possible to get the date of the class name or class ID? I just used the following to get the date of the post, but there are image galleries and each image has a different upload date: echo ...
1
vote
0answers
177 views

Importing Product Variation Images Swatches

I want to upload several thousand variable products to Woocommerce using the WP All Import plugin. I also want to display product variations using the Color or Image Variations Swatches plugin, which ...
1
vote
0answers
15 views

How to assign a customer to an order?

I have a problem assigning a customer to an order using a php script. Is it even possible? I know, that it is possible to get the customer ID back from the order, but I can't find a way, how to set ...
1
vote
0answers
23 views

Output custom field value to post string

I am trying to get a custom field called "u-courseid" its a field that was created by a theme plugin. My goal is to output the value of this field after the post name. So the output would be " Post ...
1
vote
0answers
57 views

Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied

When I load the content using ajax it doesn't apply MediaElements.js to my audio player, so the audio isn't display. I think this is because the MediaElement.js is loaded with wp-footer(), and this ...
1
vote
0answers
23 views

How to exclude a widget from page 1 of a paginated post

I want certain widgets to not appear on page 1 of a paginated post but appear on all other pages (page 2,3..so on), and some other widgets to appear on only appear on page 1 and not the rest of the ...
1
vote
0answers
33 views

Can't find infinite loop cause

I am working on the below function which will eventually create a set of posts based on meta data entered into a "parent" post. I'm running into an infinite loop when hitting the save button, which I ...
1
vote
0answers
48 views

bulk change of image setting “link to” to “link to: image url ”

i want every image present on my wordpress site with setting "link to: none" or "link to: post url" became in "link to :image url" ho make this for old post and for new post ? i tried this code in ...
1
vote
0answers
20 views

Individual testimonial taxonomy not displaying (white screen)

I am using a testimonials plugin which is working fine except for when I try to view the testimonial entry as an individual page The plugin author suggested changing the testimonial slug and updating ...
1
vote
0answers
71 views

Custom Loop through category menu to include sub categories

In my custom wordpress theme I currently have the below loop to the main categories <?php $menu = wp_get_nav_menu_object('navigation'); $items = wp_get_nav_menu_items($menu->term_id); ...
1
vote
0answers
77 views

Change logo based on incoming domain

The agency I work for are trying to get a client's logo to change based upon the incoming URL. Now, we have 4 different URLs, therefore 4 different logos. Currently, we are using an if/else ...
1
vote
0answers
29 views

wordpress 4.4 self hosted video (html5) doesn't show

I was developing WP theme on my localhost (version 4.3). The client wanted to be able to add self-hosted videos. So I wrote shortcode and implemented it in Visual Composer. Basically, this shortcode ...
1
vote
0answers
49 views

Insert term and child term from frontend

I have this taxonomy: "free", and I want to insert new term (ex: Season) and then insert a child to this term (ex: episode) in the same form. Taxonomy "free" Add new term: ex: Season, and then add ex: ...
1
vote
0answers
90 views

inserting a post from an extern php file but post content doesn't show on wp site

I'm doing a php file that insert post's on my wordpress site. I'm filling all the fields in wp_posts, but the content doesn't shows on my wordpress site. I wonder if it's because the categories are ...
1
vote
0answers
61 views

How to add custom taxonomy slug in CPT permalink?

This is the code i have until now to add a CPT articles and taxonomy articles-category. The code works, sort off. The pages are displaing correct (when i access them directly): articles/ ...
1
vote
0answers
82 views

Refresh page after update_post_meta

I have created a input field on a front-page where the value of the database is on the same page as the input-field. If a value is passed to the database I have to reload the page for it to show on ...
1
vote
0answers
304 views

Add new shipping method or change shipping rate manually

I'm trying to add a new shipping method to my Woocommerce suite. Basically I'm trying to apply two different Shipping rates to an order depending on their user role. I'm using Flat Rate as one of ...