Categories
WordPress

Lightweight WordPress commenting system plugin: wpDiscuz

I’ve been sick of using JetPack or Disqus on my site for years, so i googled “lightweight WordPress commenting system” and didn’t get anything exactly mentioning that phrase. I got merely two articles talking about a new plugin called wpDiscuz, so i gave it a shot. This was sometime in 2017/2018. I’m finally getting back to this drafted post about it. wpDiscuz is fast being that it uses AJAX lazy loading. I liked that it …

Categories
WordPress

Reset WordPress user password with MySQL Workbench

In case you run into an odd situation like i did where i didn’t have access to phpMyAdmin and the password reset via email wasn’t working, but i did have access to MySQL Workbench and the database, this can help you. First, make sure you can connect to your WordPress database via MySQL Workbench. Second, use this MD5 Hash Generator website to create a new MD5 hash of your desired password. Basically, on the site, …

Categories
WordPress

Finding an SEO WordPress plugin i actually like

Yoast irks me. Why i left them maybe a year or so ago in lieu of The SEO Framework. I have gists and a post about Yoast removing Yoast superfluous code — <article> tags — from the <head> of the site, sending Yoast meta box to the bottom of Dashboard editor pages. Yoast was like a needy child, always nagging about something. It was also slowing down my site with its bloat. I needed something simple. …

Categories
PHP Server Configuration WordPress

Redirect all .php pages excluding WordPress /wp-admin directory files

I ended up having 100s of crawl errors in Google Search Console for URLs that were ending in /blah.php and macariojames.com/dir/subdir/subdir2/blah.php for some reason. Some even ended in .html, which was easy to resolve since WordPress doesn’t use .html files, but .php files. After failing to write my own .htaccess RewriteRule and RewriteCond code, i found some useful code that i was able to tailor to fit my needs. I’ve shared it below. This code …

Categories
Website Optimization WordPress

How to disable JavaScript and CSS added by WordPress plugins and speed up your site in the process

TL;DR Plugin developers should use if(is_admin()) and get_current_screen() to determine the page and load these scripts and files conditionally. And the non-plugin developers, we can dequeue the scripts and css files easily. In short: Be an awesome, caring and courtesy developer, please.

Categories
CLI PHP Server Configuration WordPress

Fix Fatal error when installing a WP-CLI package

TL;DR Composer was using an outdated PHP, while my server was running the latest. Need to get them to use the same PHP version. Instructions below.

Categories
Server Configuration WordPress

Secure a WordPress site without using plugins — during your lunch break

Keeping a WordPress site secure is paramount. Without using plugins—we’re going DIY—here are ways to secure a WordPress site during your lunch break. The big, popular security plugins use many of these tactics and code, so why not implement them yourself? At least learn what they are. If nothing else, one less plugin running in the background frees resources, leading to faster site load times. Delete default admin user WordPress powers roughly 30% of the …

Categories
CLI WordPress

WordPress: Fix WP-CLI error with sed or find commands

One suggested solution was to install the GNU version of the sed command — npm install gnu-sed — but i eventually found a command-line solution once adapted to my situation that worked.

Categories
JavaScript WordPress

Inject JavaScript with WordPress data it can reference using wp_localize_script()

Say you have JavaScript files that rely on images that live in your current theme directory — or elsewhere outside of the domain root — and they’re not loading without hard-coding the URL into your code. Or, you may be developing locally and when pushing to a sandbox or production server, tired of changing the file path depending on the server. You must register the script before calling wp_localize_script() then queueing it. This allows you to …

Categories
WordPress

Move WordPress installation to a sub-directory — easily and without breaking sh*t.

For various reasons, i recommend installing WordPress (WP) in a sub-directory rather than in the default root of the domain — such as in the /public_html or /htdocs directories. From here on out, i’m going to reference the root directory as mysite.com/. If you already have a site installed at the root directory, perfect. This guide is exactly for that situation. If you do a fresh install, these can be adapted to it. Just follow …

Categories
Software WordPress

Local by Flywheel hangs on “Checking System…” (macOS)

Local by Flywheel was running without a hitch for the 30 minutes after i initially installed it, setup a local site, and tried out various settings. I was working on a new post regarding local WordPress development using the app. It’s part of a series i’m writing on local development environments and workflows. While documenting the steps and time it takes to close and restart Local with a site running, i ran into an issue with …

Categories
CLI WordPress

WordPress WP-CLI PHP Notice: Undefined index: HTTP_HOST

I manage a ton of websites. Some servers house several separate installations, which makes it cumbersome to have to login through the web to manage each site. (No multi-site setups.) I decided last weekend after attending my third WordCamp ATL (#WCATL), i’d start to actually utilize wp-cli on a daily basis now that it’s matured and powerful. Heck, i even thought about writing an ebook on using wp-cli. Stay tuned. Anyway, to the issue at …

Categories
Social Media WordPress

WordPress + ACF + Instagram Feed without API

[Update: See bottom for screenshots] With the the privacy climate these days — see Facebook’s woes with Cambridge Analytica — Instagram has finally enforced the API changes and limits they announced in January. After riding dirty with the feeds for the past few months (despite the summertime deadline), two sites’ feeds stopped working last week. Crap. I needed a quick fix; something easy to implement, and preferably without having to use the API. Signing up again or …

Categories
Web Development WordPress

WordPress Developers: to use functions.php or a functionality plugin?

I first learned of the functionality plugin vs functions.php way of thinking either from a StackOverflow comment while searching for some elusive WP answer or via Dave Clements’s posts: Create Functions Plugin and Putting Things Where They Belong. Not sure it matters, but i like to attribute inspiration. Anywhoo… The more i’ve tackled WordPress projects, especially while working in-parallel on a few projects or back-to-back with little time to rest, i’ve come to look for more efficient …

Categories
WordPress

BackWPup WordPress plugin – Error when running email backup job

Looking for an easy WordPress backup solution, i decided to give several plugins a try. One of them was BackWPup. While testing it out, i ran into an issue trying to send backups via email. It was due to the DMARC policy on my domain. Below is an email i received (in Spam) when attempting to do the email backup option. Quick trick to circumvent this issue is to set the “From” address in the …

Categories
WordPress

WordPress Custom Shortcode Not Displaying or Breaks Page

So, i’m working locally on this site, tweaking my Wikipedia User Contributions Display plugin, and i noticed that some tweaks i pushed live are actually working fine, but locally they’re not (kinda backwards, i know). Heck, anything after the plugin shortcode doesn’t display–it actually breaks the site (footer scripts and other code fails to run). I google for some fix but nothing concrete. I spot something about PHP may be the culprit, but no one …

Categories
WordPress

Removing article:tag from Yoast’s WordPress SEO plugin

Scroll down for the code since i’m a little long-winded on this post. Ye’ve been warned. Yoast’s WordPress SEO plugin is awesome at getting you quickly setup with adding Twitter Cards and Facebook OpenGraph data to your website. But over the latest iterations it’s either added superfluous meta data or removed the options to toggle what is or isn’t shown (version 7.1 is a big culprit of it, which is currently running on this site, …

Categories
WordPress

WordPress activity log plugin: Stream

Some backstory: i’ve been developing several WordPress projects back-to-back or in parallel in the last few months, and once they’re ready to transfer from local dev environment to staging server, the content provided to me from clients or coworkers usually becomes stale, needing to be updated with increased frequency or in sporadic bulk edits, which would keep my local database annoyingly out of sync with the staging database. It was a clusterfuck — for lack …

Categories
WordPress

WordPress FTP Error when upgrading WordPress core or plugin

You go to update a plugin or the latest security patch for WordPress, but when you click update you’re prompted for FTP credentials. It can be frustrating and annoying, but it has (typically) a simple fix. This WordPress FTP error is frustration at its peak. You’ll need access to your wp-config.php file and ssh access to your server.  Two steps: Apache server — via terminal/command line run sudo chown -Rf www-data:www-data /var/www/html (or could just be /var/www; …

Categories
WordPress

WordPress: You Changed the Site Address URL and now Blog Posts are Blank!

So you installed WordPress in a sub-directory because you want your URL to still be simple, such as installed here www.mydomain.com/wordpress-installed-here/ yet visitors will see www.mydomain.com when navigating your site, but after doing so your blog posts and pages show up as a white blank page. Not good. Luckily, there’s a simple fix! Just update your .htaccess file in the main directory of where your site is located. I’ve put example code for the .htaccess …