Remove Illegal String Offset warning on WordPress sites

Remove Illegal String Offset warning on WordPress sites

The “Illegal string offset” warning error occurs when the function is being passed as a string instead of an array. The problem lies elsewhere, with the caller of the code not providing a correct parameter.

If you are good in PHP, you can offset this error by replacing the line being referred in the warning notification by:

if (is_array($inputs) && $inputs[‘type’] == ‘attach’) {

The warning message is new to PHP newer versions. Old versions didn’t warn if this happened. They would silently convert ‘type’ to 0, then try to get character 0 (the first character) of the string. I got the same error while working for a clients website, in my case the PHP version of the site was 7.1.6 – I  just reverted back to PHP version 7.0.20 and the error disappeared.

Most of the themes haven’t actually updated to latest PHP. If you don’t want to update your theme now, you can revert back to PHP version, and this will remove warnings from your website.

Mixed Content Issue while installing SSL on WordPress site

Mixed Content Issue while installing SSL on WordPress site

You have just moved from HTTP to HTTPS with an SSL certificate and landed with this ‘Mixed Content Issue?’ Don’t worry, in this article, I’ll show you how to properly make your WordPress site fully HTTPS secured.

What is HTTPS, SSL and why do you need it?

Every day we share our highly-secret and personal information (including credit/debit card details) with different websites. In order to protect this data transfer while buying or selling stuff online, a secure connection needs to be created. HTTPS (Secure HTTP) is an encryption method that secures your personal information by end-to-end method, making it harder for hackers to jump in your data. In order to get HTTPS encryption method, an SSL certificate is required which is provided by your hosting company, and they’ll also install it on your server. A fairly simple process! And even some WordPress hosting providers offer free SSL with their plans, including 1and1, GoDaddy etc.

Updating your site to HTTPS via WordPress:

  1. Update your site URL’s by jumping to Settings » General, updating “WordPress and site URL address fields” of your site.
    mixed-content-issue-while-installing-ssl-on-wordpress-site
  2. Integrating every page’s content to be compatible with your new HTTPS server is hard, here is a tweak, you can do this easily by installing WordPress HTTPS plugin available for free.

mixed-content-issue-while-installing-ssl-on-wordpress-site-1

Give your site 24 hours to completely change its images/videos and content’s URL to HTTPS. That’s all folks!

Still finding mixed content message? View page source of the web page (right click on your webpage and click ‘view page source’) showing the particular error. You’ll see the lengthy HTML code, try to find any links still using HTTP in URL address, now change it to HTTPS.

[How To] allow Editors and Administrators to Maintain the Ninja Forms

[How To] allow Editors and Administrators to Maintain the Ninja Forms

Ninja Forms is a free, fast and really efficient form builder. Unfortunately, Ninja Forms’ developers have locked WordPress roles, enabling only Administrators to view submissions or bring about some changes in the forms.

While working for one of my client’s website, I was really freaked out to see this, as I do not want all the users to have rights like administrators. In my case, I wanted to allow admins as well as editor to create and maintain forms. This is how I added some tweaks in the plugin, follow step by step:

  • FTP login to your website (by FileZilla) and create a new folder: ‘wp-content/plugins/my_custom_change_ninja_forms_all_forms_capabilities_filter’
  • Open the newly created folder and create an empty file ‘my_custom_change_ninja_forms_all_forms_capabilities_filter.php’
  • Edit that empty file, and paste at the top:
<?php
/*
Plugin Name: my_custom_change_ninja_forms_all_forms_capabilities_filter
*/
  •  Add this code just below the above code:

// To give Editors access to the ALL Forms menu
function my_custom_change_ninja_forms_all_forms_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_all_forms_capabilities_filter' );
add_filter( 'ninja_forms_admin_all_forms_capabilities', 'my_custom_change_ninja_forms_all_forms_capabilities_filter' );
// To give Editors access to ADD New Forms
function my_custom_change_ninja_forms_add_new_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_add_new_capabilities_filter' );
add_filter( 'ninja_forms_admin_add_new_capabilities', 'my_custom_change_ninja_forms_add_new_capabilities_filter' );

/* To give Editors access to the Submissions - Simply replace ‘edit_posts’ in the code snippet below with the capability
that you would like to attach the ability to view/edit submissions to.Please note that all three filters are needed to
provide proper submission viewing/editing on the backend!
*/
function nf_subs_capabilities( $cap ) {
    return 'edit_posts';
}
add_filter( 'ninja_forms_admin_submissions_capabilities', 'nf_subs_capabilities' );
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'nf_subs_capabilities' );
add_filter( 'ninja_forms_admin_menu_capabilities', 'nf_subs_capabilities' );

// To give Editors access to the Import/Export Options
function my_custom_change_ninja_forms_import_export_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_import_export_capabilities_filter' );
add_filter( 'ninja_forms_admin_import_export_capabilities', 'my_custom_change_ninja_forms_import_export_capabilities_filter' );

// To give Editors access to the the Settings page
function my_custom_change_ninja_forms_settings_capabilities_filter( $capabilities ) {
    $capabilities = "edit_pages";
    return $capabilities;
}
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'my_custom_change_ninja_forms_settings_capabilities_filter' );
add_filter( 'ninja_forms_admin_settings_capabilities', 'my_custom_change_ninja_forms_settings_capabilities_filter' );
  • Go to your WordPress Dashboard Plugins page and see that there is now a new plugin listed – called ‘my_custom_change_ninja_forms_settings_capabilities_filter’
  • Simply activate the plugin and Woah you are done. Now, editors along with administrators can bring about changes in the forms and also see the user submissions.
Disclaimer: As the next update by developers approaches, this tweak would be deleted automatically. Ninja Forms plugin is devoted to be used by Admins only,  kindly allow the permission only to people whom you trust. Before all of the above mentioned tweaks don’t forget to backup your site. The above mentioned code was found on WordPress support forum. If you want to report anything about this article, kindly email: [email protected]
[How To] automatically add www to your WordPress URL

[How To] automatically add www to your WordPress URL

If you are new to WordPress you might be having issues to automatically add www to your WordPress URL. Well, don’t stress out, you just made a little error while installing WordPress on your domain. Follow these simple directions:

1) Login to your WordPress dashboard and navigate to the Settings > General mode.

1

2) In WordPress Address (URL) option, add ‘www’ before your web address, just like in the image below. But, make sure there’s no “/” in the end of your URL.

2

Now, if someone simply types “yourwebsite.com” into their browser they should be seamlessly forwarded on to www.yourwebsite.com. And this thing will not affect your Google rankings.