Developer // Accessing WordPress URL Function Values Within Javascript

During my custom WordPress theme development I often find that it would be really useful if I could just use the WordPress get_template_directory_uri() or home_url() functions from within Javascript.

For example when trying to set the url of an Ajax request in jQuery, or setting the path to an icon image file on a Google Map.

Thankfully, if you’re using WordPress in the way it’s intended, there is a very simple way to make this possible. Continue reading “Developer // Accessing WordPress URL Function Values Within Javascript”

Developer // ACF: Counting Repeater Rows Inside Flexible Content

So I was trying to count the number of repeater rows for a ACF repeater field in my WordPress theme, something which I figured would be a simple use of the count() function on the returned field.

In turns out though, that the following code doesn’t work with a repeater field if it is part of a flexible content block. Continue reading “Developer // ACF: Counting Repeater Rows Inside Flexible Content”

Developer // Removing Sub Page Menu Item In WordPress Whilst Still Allowing Page Access

Had an error in from a website where the admin couldn’t gain access to edit registrations in WordPress backend. Receiving the following “you are not allowed access” error:

wordpress access error

On closer inspection to the code it appeared in trying to hide the ‘Add New’ option for the post type from the admin menu, the developer had inadvertently removed access to the registration form page. Continue reading “Developer // Removing Sub Page Menu Item In WordPress Whilst Still Allowing Page Access”

Developer // Adding Categories and Tags Functionality To WordPress Custom Post Types

Had a request from a client to add categories and tags to their resources custom post type in WordPress.

Obviously I assumed there were predefined WP functions to implement this, but I found it hard to pin down a complete solution, so thought I would share mine here. Continue reading “Developer // Adding Categories and Tags Functionality To WordPress Custom Post Types”

WordPress: curl_setopt() error when installing plugins on 1and1 host

When trying to install/activate plugins on my WordPress site after having to reset them following a host change, I received the following error

Warning: curl_setopt(): supplied argument is not a valid cURL handle resource in ….

This turned out to be an issue with my 1and1 hosting, and how they configure their servers.

To solve the problem I added the following to my .htaccess file:

Getting 500 Server Error When Trying To Access WordPress Admin Menus

After switching host locations for my wordpress blog at the weekend I found I could not access my website due to errors in various plugins. After renaming the offending plugins’ folders on the server my page was functioning again, but when I attempted to login as admin to reactivate the plugins I was greeted by a 500 error.

After Googling I discovered the following solution was to deactivate all plugins in the database to regain access to the administrative menus.

Find the active_plugins row in the wp_options table,
Change the value of the field to: a:0:{}