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

learn more… | top users | synonyms (1)

0
votes
1answer
26 views

Why is it necessary to prevent direct access to included files?

Why is it necessary to prevent direct access to included files? For example: if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } I notice many plugins do this but I don't see ...
-2
votes
1answer
36 views

Where is the POST response body generated in PHP? [closed]

I am trying to understand a web app template for wordpress. They do not follow the POST/REDIRECT/GET pattern, and it's very annoying on an HTTPS website. There is a static page with a next button on ...
1
vote
1answer
31 views

My form action url is being prepended with a directory that does not exists

I'm trying to allow users to upload audio via form and HTTP POST request. Here is the relevant form code, from my page-profile.php : <form method="post" ...
1
vote
1answer
39 views

WP functions in .js

I have a huge main.js which includes 99% of my JS + plugins' JS. While loading time is a little bit longer when user visits the site for the first time, it gets cached and there will not be any other ...
1
vote
2answers
39 views

PHP code inside shortcodes

Basically, I have this line of code: <?php echo do_shortcode('[O_U user_name="operator" blocked_message="This page is restricted for guests."] **Content Goes here** [/O_U]'); ?> Now, inside ...
0
votes
0answers
30 views

Inline Styling a div from a Custom Metabox

I am building a custom page with repeatable metaboxes that controls content, images and background image. I am having issues when it comes to displaying the background image as an inline style. As of ...
0
votes
1answer
19 views

Set post title based on first h2 element in the content section

I have a front end editor set up for users to create posts and I would like to make it as simple as possible to create posts with the least amount of fields involved. Is it possible to generate the ...
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; ...
0
votes
0answers
21 views

Displaying friend's posts only

So I am using the WPMU Dev friends plugin which adds functionality for WP members to search for friends and to add new friends etc. There is a specific function defined in the PHP file which says it ...
0
votes
0answers
33 views

Extreme delay on SMTP email with Contact Form7 after update wordpress on 4.0.4. Why?

I have a wordpress 4.0.2 with ContactForm7 and WP-Mail-SMTP plugin. My ContactForm7 form sends an email with smtp option within (1) second.No delay , everything fine. But If I update my wordpress ...
0
votes
2answers
19 views

PHP - Multiple variables in insert post array

I am currently creating a post programmatically, with the wp_insert_post function but am having some difficulties when adding two variables into the content part of the array. I would like to add ...
0
votes
0answers
27 views

update_user_meta and wp_update_user not working

I have an array of users that I've successfully updated as described here foreach ($users_out as $key_u => $value_u) { $user_id = $value_u['writer_id']; $user_login = $value_u['username']; ...
0
votes
0answers
35 views

Getting invalid user ID error when creating a new user with wp_insert_user

I'm trying to insert users into wordpress from a foreign database and I've prepared my $userdata as foreach ($users_out as $key_u => $value_u) { $user_id = $value_u['writer_id']; ...
0
votes
1answer
29 views

Create a Wordpress shortcode using PHP [duplicate]

I am currently using the following code within single.php (after the_content) This gets the store_name from custom field as $merchant from the post and then returns a list of products from that ...
2
votes
1answer
25 views

How can I add a specific, custom widget to my theme's header.php?

I've created a custom widget that I've named openingTimesWidget which extends the WP_Widgets class and follows the guidelines for creating widgets... What I'd now like to do is not only add this to a ...
1
vote
1answer
26 views

How Restrict access to admin dashboard by specific static ip?

i'm trying to restrict access to admin dashboard (wp-admin.php) by specific static ip so tried to add .htaccess to the wp-admin and set <FilesMatch "admin\.php$"> Order deny,allow Deny from ...
0
votes
1answer
33 views

get second ID from array

I need to get the second attachment ID from this function and put it into a separate custom field: add_action('pmxi_saved_post', 'replace_thumbnail', 10, 3); function replace_thumbnail($id) { ...
1
vote
1answer
24 views

Getting id of poll from WP database

So I have a php statement: $latest_pollsid that contains a number which increases by 1 every time a specific form is submitted. I am reading this statement into several functions and for one of these ...
1
vote
1answer
20 views

How to customize a permalink (URL) structure?

i am using $post->guid to get the URL of an attached file to my post. the output is something like this: http://example.com/foo/ [where foo is the file name]. now i want to make a URL like ...
11
votes
3answers
461 views

How to deprecate a function used in a plugin?

One of the functions I'm using in my plugin is polluting the global scope with a name that could collide with another function (used in another plugin). So, I guess I should deprecate it. But how ...
1
vote
1answer
13 views

Is it possible to add a custom page to a free Wordpress site? [closed]

I'm trying to add a custom page to my Wordpress website. I found this link, which says that I need to add the template to the theme folder, but I have a free Wordpress website, so I don't have access ...
-2
votes
1answer
20 views

Show post like this image in my newssite [closed]

I want to know how to query like this photo in my newssite for a category. See this image and help by give the query code. Do I use Offset or if else. How to query for this .
0
votes
0answers
20 views

Return a css class in functions.php snippet (WP Job Manager)

How can I trigger a CSS login lightbox when clicking on the "sign in" button on the following page (Wordpress Demo)?: http://workscout.in/post-a-job/ This is the CSS class that I found: <a ...
3
votes
3answers
59 views

How can I change Wordpress domain from remote to localhost?

I recently had a system crash and had to reinstall WordPress with my backup files. In the JavaScript log I began throwing errors pertaining to the domain and realized I was still using the remote ...
0
votes
1answer
62 views

PHP- Why is my contact form keep showing it is invalid? [closed]

I was working on contactus.php form. I am not testing whether the email will be sent to our account. However, my objective is when the form is invalid, it will reload the page and redirect user back ...
0
votes
1answer
14 views

Advanced Custom Fields [closed]

I am trying to call a field and it's heading on a post type. I want to call headings only if there is content in the field. I'm really new to PHP and am unsure how it all works. I have added the ...
1
vote
0answers
15 views

Ad “sort by” to my woocomerce shop page [closed]

I have a question regarding woocomerce, I am quite fresh to it and am not sure if this is done via some settings, or something is missing in my code. I have this piece of code to display my products: ...
0
votes
0answers
43 views

Why a class property becomes empty?

I have a class with a private property/variable named $postID that I can pass successfully (this was tested) to every function within this class except one named handleForm(). When it is passed to ...
2
votes
1answer
20 views

Run a Parallel PHP Application with Wordpress

I have a PHP based application that runs on the Google Maps API. Most of it is written in straight PHP and Javascript, but I want to use some sort of CMS or tool to upload images, because there will ...
0
votes
2answers
29 views

Create a custom page URL

I have and archives.php file developed which I want the user to be able to access. How can I register a new page so that when a user types mysite.com/archives he goes to this page?
0
votes
1answer
68 views

How to call external functions from a PHP script in a WordPress plugin?

I'm a WordPress beginner, and I have tried to develop plugins, but I don't know how to call external functions in a WordPress plugin. For example, I have an external PHP script called download.php in ...
0
votes
1answer
46 views

Simple php in wordpress widget [closed]

I am trying to calculate with simple maths but I cant get the following form make the calculations and output the results. Unfortunately I am a newbie. What's wrong? <?php add_action( ...
5
votes
1answer
116 views

How do I add a WP_List_Table to WordPress page?

I have WP_List_Table and i'd to like to add it to a page, and I searched and I have not seen examples on how to do this.Does anyone have a snippet on how I can achieve this? <?php /* Plugin Name: ...
3
votes
1answer
40 views

Issue with foreach on duplicate meta_key's

Im storing using add_user_meta custom values that get sent to the front page of the website. Here is the php code. $user_query = new WP_User_Query( array( 'fields' => 'ID' ) ); ...
2
votes
1answer
45 views

Using spl_autoloading within WordPress plugin

I'm struggling with spl_autoloading inside a namespaced WordPress Plugin. I already revised these questions: http://stackoverflow.com/questions/17806301/best-way-to-autoload-classes-in-php ...
1
vote
1answer
34 views

How to deal with checkboxes in edit page?

Im trying out new term meta feature introduced in 4.4. I've got plenty of checkboxes which represents features in custom taxonomy edit screen. My current setup (note that Im using correct hooks, I ...
-1
votes
1answer
32 views

How to list all the posts in a personalized page? WordPress

Well, I created a custom page where I need it to return all the posts that have registered on the site, like the index. I tried to do in the normal way, by creating a custom page and assigning it the ...
1
vote
1answer
18 views

Troubles with saving metabox

So I used to have a few metaboxes, which were labelled poorly (meta_1, meta_2) and I went about renaming them to make it easier to understand for maintenance. When I went back to see how other users ...
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' ) ); } ...
2
votes
1answer
38 views

Displaying Only Certain Tags in Loop

What I'm trying to do is alter the loop across my site so it will check the site URL so it will know which tag to display. For example, if I give some posts the tag "golfclubs", I want it to work ...
0
votes
0answers
26 views

Use two categories and remove for first data

So I find id for two post categories, and now I'm trying to write php code in content-single.php in acesspress lite. This is that I obtained: <article id="post-<?php the_category_ID(7); ?>" ...
0
votes
1answer
14 views

Assistance with elseif [closed]

I'm having trouble constructing an elseif statement. Within my loop I want to display one of the following, in order of preference: If there's a featured image, echo that. If not echo the custom meta ...
0
votes
0answers
35 views

Add product to cart and change price, within template file

I'm trying to add a product to the cart which has a price of 0.00 and then dynamically change the price depending on what the user on my site inputs into the form I've made. I've looked at a couple ...
0
votes
1answer
25 views

Passing the custom field values in the wp_get_current_user array function

How to pass the custom field values which were stored while creating a new user into the wp_get_current_user array function When I call the wp_get_current_user() function the result which I found is ...
1
vote
2answers
32 views

How do I Turn This Into An if statement?

PHP noob here. I've got this query I've written to get the information of all child pages of the page you're currently on: <?php $pages = ...
2
votes
1answer
81 views

Add CSS animation as Preloader to WordPress

I found a CSS animation snippet on Codepen, and would like to add it in my WordPress site for preloader animation, but I couldn't find any related help or plugin that would allow me to add a Preloader ...
0
votes
4answers
45 views

POSTS list in WordPress by views

I need a code that causes: <?php while ( have_posts() ) : the_post(); ?> List according to the amount of VIEW, is like to list popular posts only that it will enter the table mh_postmeta, and ...
0
votes
3answers
59 views

MySQL query in Wordpress with AJAX

I have a search form which searches the DB and returns back some data. I have managed to use Wordpress wpdb to connect and use select statement on the table and retrieve data. Everything works ...
0
votes
1answer
71 views

Using Wp_Query, Json to add Highcharts series data

I just added a custom Highchart to my wordpress single custom archive page. http://propertywise.malisa.agency/en/district/khlong-toei-2/ Using the following function call from within the Highcharts ...
1
vote
0answers
24 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 ...