Author: LOLinDark

Why was a Pro-Upgrade created?

Why was a Pro-Upgrade created?

Today I had to remind myself, why I decided on a separate professional-level upgrade that would contain many add-on features. This thought came to me when I begun working on the TwitchPress Pro Extension, an improvement in how the pro files are management. I realized others may wonder why all TwitchPress work doesn’t go into the open-source plugin on and I seek backing for that plugin.

My Reasons

I wanted to blog my reasons for a pro-edition, for the record. In short, there must be a reward for backers/contributors and a clearly defined and separated road-map within development is the easiest reward I could come-up. It is also an easy reward to keep giving in the form of updates.

I also felt many of my backers would appreciate access to additional WordPress tools that aren’t accessible to the entire community. I can’t realistically guess how many streamers feel a strong sense of competition but I do believe streaming is a serious enough hobby to have ambitions that require an edge. Popular streamers define themselves in a way that clearly sets them apart from others and I offer just one of many additional tools to do that. By spending additional hours on creating features only giving to those who are willing to support the project, not always with money either.

I can assure everybody that the pro-upgrade features would not be created and released within the core plugin without some level of commitment by the community to support me back. One of the most important thing I have learned over the years is where to draw the line on giving to a community especially when support is a factor, that can get messy and can be time-wasting on a monthly basis.

Balanced Model

I have mentally-wrestled for many hours (in total) over the project-model I should use to provide all of my open-source work (not just TwitchPress), reward backers and raise funds to cover costs. Over the years I tried various approaches, but finally arrived at an open-source and crowd-funded model that suits me.

My model takes professional practices into great consideration i.e. version control, GitHub, transparency, ethics, responsibility and support. Altogether this is a massive undertaking considering I am not paid for this – any money contributed to the project barely covers my costs while managing it. My approach is a balance between open-source contribution to the WordPress community and a more restricted pro/private area within development for streamers themselves, who may not be developers.

Shortcode Not Working -Shortcode Showing Instead of Content

Shortcode Not Working -Shortcode Showing Instead of Content

While testing many short-codes all at once I run into a self-made problem that could happen to anyone. When pasting shortcodes the WordPress block-editor applied code-blocks automatically. This happened on multiple pages I was creating quickly and on visiting the front-end I found none of the short-codes worked.

Example of a WordPress shortcode in a code-block.

You can tell the shortcode in the image is in a code-block because it has an outline. If you see this on your site, you need to remove the code-block and try again.

Missing Client ID

Missing Client ID

The client_id value is missing from the URL because it was not sent by TwitchPress

A message or error that includes “missing client id” will be caused by either a new installation or a bug. When the Client ID (aka App ID) has not been entered by the administrator and someone attempts to use the Twitch Login feature or a number of other actions, this response will be giving by the Twitch API.

Initial Setup

This is best done using the TwitchPress Setup Wizard which can be accessed through the WP Help tab when on any TwitchPress view. There is also a settings page where app credentials can be entered/updated quickly at anytime.

Twitch API credentials form showing an empty Client ID field.

If this doesn’t appear to be the cause if your problem please report a possible bug and description the causing action as this API response can be caused by many things. That makes it difficult to pin-point the cause.

PHP API Calls to Twitch Helix

PHP API Calls to Twitch Helix

None developers might be amazed, how easy it is to make a call to the Twitch API within the TwitchPress plugin. If done in the correct place, anyone can easily copy the code on this page and make a request using one of the many endpoints (URL) available in the Twitch API documentation.

Always WP_HTTP_Curl

It is possible to make HTTP requests without using the WP core – but it’s not the way WordPress developers prefer. So the examples on this page always use the WP_HTTP_Curl and are designed to teach how much layers there are to building a request that eventually ends with WP_HTTP_Curl.

Method A

This is a simplistic method designed to use fool-proof (pre-made) post-request (after the request) functions. Such functions will apply as much validation as possible to determine if we have the data we need (sent from or not.

    $helix = new TwitchPress_Twitch_API();
    $user_object = $helix->get_users( null, $twitch_username );

You can change “get_users” to another method from those available in the TwitchPress_Twitch_API() class.

The class TwitchPress_Twitch_API() uses TwitchPress_Curl() class as does TwitchPress_Streamlabs_API() and eventually TwitchPress_Steam_API().

Method B

It is acceptable to use the TwitchPress_Twitch_API() class without a method already stated within the class itself.

$twitch_api = new TWITCHPRESS_Twitch_API();
$endpoint = '';
$headers = array( 'Client-ID' => twitchpress_get_app_id() );
$curl = $twitch_api->WP_Http_Curl( 'GET', $endpoint, $headers );       

This example shows how we can access the values that build our HTTP request. We can also control when $curl finally makes the call and it’s up to you how to process the response.

Method C

The next method uses very little of what TwitchPress offers. Even the functions adding id, secret and token can easily be replaced. What does happen, that is very TwitchPress, is the creation of a call ID for troubleshooting.

                // Create new curl object for performing an API call...
                $new_curl = new TwitchPress_Extend_WP_Http_Curl(

                // Add headers if the default does not add them in the current package...
                $new_curl->option_headers_additional( array(            
                    'Client-ID' => twitchpress_get_app_id(),
                ) );

                // Add body parameters if the package hasn't been designed to add them automatically...

                // Now add miscellanous values that will make up our curl request...

                // Finish the request, this makes the call and sets $this->final_output...

The important thing about this class, is that it extends the core class and so it’s development will continue in that direction. The purpose of doing this, is to add custom troubleshooting, diagnostic and validation that suits TwitchPress or Twitch. So expect changes to this class.


Someone new to all of this might be wondering where to place my examples. My advice is to create a child-theme which is basically a partial copy of your main theme. We copy the folder name, add “child” and only copy the theme files that we are going to edit, into our child theme folder. This way we don’t lose changes when our theme is updated.

I recommended doing more reading on child-themes, a very important aspect to WordPress and key knowledge for taking your WP site in the direction you want. Then you should understand where to put some of these examples – for testing only!

The final place for my code, should be a functions.php file (or similar) and please do not ever replace functions like “twitchpress_get_app_id” with raw values that a hacker could access if they obtained your themes original files.