Articles of plugin development

Best practice for plugin: always detect admin-ajax call?

Recently I was debugging/hacking a plugin authored by someone else. I put a breakpoint at a spot I was interested in – a relatively complex admin page. I noticed that even during admin-ajax calls this particular plugin still goes through all the logic to generate the page in question. Even though it is never displayed. […]

About a programming language starts with <# #>

Is that a Javascript code?? The following code inside a php class file but after closing php tag start these lines and the [data] variable not defined in this class i want to trace the [data] variable, where could i find it .. in js files?? and how the data passed through this variable inside […]

Data inserted by wpdb insert is different than data pressnt in database.

I have made this insert query: $insertsuccess = $wpdb->insert( ‘compservices’, array( ‘orderId’=> $orderID, ‘orderedTime’ => $date, ‘useremail’ => $customerEmail, ‘address’ => $address , ‘mobile’ => $mobile , ‘servicecenter’ => $servicecentername , ‘timeslot’=> $timeSlot, ‘preferredlanguage’=> $preferredLanguage, ‘status’=> $orderStatus, ‘completedDate’=> $orderCompletionDate, ‘userissue’=> $userIssue , ‘userproduct’=> $userProduct ), array( ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, […]

Wp Debug Enabled True Notices and Warning

Notice: Undefined index: Zumpito_event_full_day in /home2/michael/public_html/domainname.com/wp-content/themes/themename/included/main.php on line 246 Warning: Cannot modify header information – headers already sent by (output started at /home2/michael/public_html/domain.com/wp-content/themes/themename/included/main.php:246) in/home2/michael/public_html/domainname.com/wp-admin/post.php on line 197 Warning: Cannot modify header information – headers already sent by (output started at /home2/michael/public_html/domainname.com/wp-content/themes/themename/included/main.php:246) in/home2/michael/public_html/domainname.com/wp-includes/pluggable.php on line 1228 The Code on Line#246 is this – $arr[‘Zumpito_event_full_day’] = ( […]

How to use a WP_Customize_Control outside of the Customizer?

I have a few custom WP_Customize_Control classes that are shown within the standard WordPress Customizer area. These are working fine. Is it possible to pull some of these out of the customizer and show them in a dedicated plugin page? I don’t need the live preview etc.. just need the customizer element to function and […]

Can I remove or edit an include() from a function with a filter?

I need to edit the output of a plugin and the part I need to change is actually a html file that is brought in using include(name-of-file.html). The function has a filter, but I am just now beginning to understand how filters work, and cannot seem to figure out how to change that path. Basically, […]

Adding Custom CSS with PHP

I am creating a WordPress plugin to help people protect their content from being copied. There are many plugins to protect content from being copied when JavaScript is on, but no plugins which protect content even when JS is off. How can I add the following custom CSS code in a PHP file, to protect […]

How to submit/upload data to database and in specific folder?

I am trying to make video plugin. Want to submit data to move the file in a folder which is in the plugin_name folder. To submit/upload I am trying the ‘plugin_dir_path()’ function. And it is not working. Just showing in browser that “uploading %”. But neither it is moving to the folder nor updating the […]

Call to undefined function error in plugin

I wrote a function inside a class that gets a user’s country from the IP address… function getcountry() { if (!class_exists(‘GeoIP’)) { include_once(“geoip.inc”); } if (empty($_SERVER[“HTTP_X_FORWARDED_FOR”])) { $ip_address = $_SERVER[“REMOTE_ADDR”]; } else { $ip_address = $_SERVER[“HTTP_X_FORWARDED_FOR”]; } $GeoIPv4_file = plugin_dir_path( __FILE__ ) . ‘data/GeoIPv4.dat’; $GeoIPv6_file = plugin_dir_path( __FILE__ ) . ‘data/GeoIPv6.dat’; if (!filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) […]

Adding Additional Variables on Menus Page

I’m learning PHP by building a plugin to show or hide menu items based on a user’s location. I am a bit stuck at the moment. In the function below, the text input is being saved to the database, but I’m having trouble saving the radio button data to the database. I want to the […]