Fix: PhpStorm don’t recognize variables created through ‘extract’ function.

One interesting issue I faced today with PhpStrom when using ‘extract’ function for generating variables from the array. PhpStorm doesn’t recognize them. After searching a while I found the solution.
There is a really simple way around this. Just explicitly declare those variables with PHPDoc comment.

For example-

extract(array('abc' => 'some string', 'd'=>'another string'));
//** @var $abc string */
//** @var $d string */
echo $abc.$d;

Code Snippet

Mock JVZOO IPN Calll

Recently I was working on IPN integration with a third party marketing tool. But, for some reason, I was not able to obtain a user account for testing this. So, I used a CURL command to mock the IPN call of I believe you some you might find this helpful so I’m sharing this below.

curl -d "ccustname=JonSnow&ccuststate=&ccustcc=&" http://localhost/jvzoo.php

just change the URL with your own URL and you are good to go.

Code Snippet, JavaScript, WordPress

WordPress Show Metabox Only When Certain Page Template Is Selected


In a recent project, I have worked on a custom page template which comes with additional options. I didn’t want the user to show the additional options metabox when the template is not active. By default, WordPress doesn’t come with an option for that. But, few lines of JavaScript saved the day.


Here is the code I used-



Send ‘CognitoForms’ form data to (or Other API) automatically without submission


For a client, we were using ‘CognitoForms’ to show different result based on user inputs. There are lots of conditional text there. After a month or so, the client wanted to make the forms in a way that the conditional texts will only appear after form submission. So, I tried to put them on success message section. But, ‘CognitoForms’only allow conditional texts. The client liked ‘CognitoForms’ because it’s easy for him to modify. So, there is 2 option available to me.

  1. Take the response data from the ‘CognitoForm’ and redirect user to a PHP page to show the result.
  2. Use JS to capture from data and send to Zapier to store them in Google Spreadsheet.

As,the second one is less time consuming and offer greater flexibility to the client, I took the second path.



‘CognitoForm’ provides client side event API. So, it was easy for me capture the data using the code below.



Solving “403 Forbidden” error on WordPress admin-ajax.php on shared Cpanel server


A few days ago, I faced problem while loading Avia advanced Layout builder on a specific page. I found an error in the console log. It was a 403 error on WordPress admin-ajax.php. I checked all the plugins for conflict but nothing was there. Even error log did not show anything significant. After googling for while I came to realize my server is blocking the request.

As the client was using a shared server with Cpanel. In Cpanel I only one module which might be responsible for blocking request. The module was “ModSecurity”.It is an open source web application firewall. I disabled this for the domain. Now, the error is gone. But, the problem is disabling the firewall all together is dangerous. After a little more googling I found the following code which let me enable the ‘ModSecurity’.

The Solution

Place the following code in your .htaccess file –

<IfModule mod_security.c>
   SecFilterEngine Off
   SecFilterScanPOST Off


The following code should not be a permanent solution because it decreases the security level on the server and potentially makes you vulnerable to the attack like SQL injection. You should take it as a temporary fix and contact your hosting provider asking to configure the firewall not to block valid WordPress operations. If they don’t make the adjustment, you should move to a hosting provider who is optimized for WordPress.


My approach of diagnosing too many redirect error on wp-admin


One of the most frustrating error in WordPress is “Too Many Redirect Error”. It is also one of the trickiest error to fix for a user with limited knowledge of WordPress because there are lots of things which can be responsible for this error.  Today I’ll share my own approach to share this issue.

Error Log

“Error Log” is my personal favorite place to start with this kind of problem. In the Cpanel or whatever you are using go and look at the error log. To make sure you got the error logged here, visit the problem page just before checking the error log. So, the error will be on the top.

Go through the error log and see if you can find anything specific to the file path. Most common issues I found there is – “xxx/xxxx/xx – is writeable by group”. This may also cause 500 error on the front end.

To solve this– Make sure all WordPress director has 755   permission and all the PHP file got a 644 permission. You can easily check and fix this using Cpanel file manager or FTP client like ‘FileZilla’.


.htaccess file is one of the most common culprits for this kind of error. To make sure if this is the case try disabling the .htaccess file and then try to access the site. If the site work ok with out .htaccess file, then just delete the file and regenerate by updating permalinks setting.

To disable .htaccess, just rename the file to anything else, for example .htaccess_disabled. If this is not the case for you then just rename the file back to .htaccess to let it work.

Site URL Settings

To make everything is working correctly. Make sure ‘Site URL’ and ‘WordPress URL’ are identical. If your ‘Site URL’ is ‘’ and ‘WordPress URL’ is ‘’ then it is not identical. Make sure both of the fields are either ‘’ or ‘’.

If you can not access the wp-admin then you can also check it via ‘phpMyAdmin’. The fields discussed above are usually found on very first of ‘xxx_options’ table of your WordPress database.

Disable all plugin and Move to default WordPress theme

If the problem is not yet solved then get ready to get your hands dirty. Now you have to disable all the plugins. If disabling all plugin makes the error gone then enable plugin one by one and check exactly which plugin is causing the problem.

If disabling all plugin don’t help then try moving to WordPress default theme.

If no luck doing all the above, then you need to seek professional help.


Paid Membership Pro: Assign custom role on checkout

Background Information

We were working for a client who has a website with “Paid Membership Pro” for membership management and “WooCommerce” integrated with this to sell the membership. There were more than 10 member levels but only one of them need to have an “Author” role. Rest of the level would have “subscriber” role.

My first approach was installing Paid Membership Pro extension for creating a role for every membership level and providing the specific one with identical capabilities like the author role. But, the client told me he wants them to have ‘Author’ role, having the capabilities is not enough.

The Solution

So, after some googling and some reading of the documentation, I build a plugin for them. And, That made the client happy.