Debugging PHP Fatal Error | WordPress.org

Moderator
t-p

(@t-p)

Your X theme seems to be the error.

Since you use a commercial theme or plugin and need support, please go to their official support channel. In order to be good stewards of the WordPress community, and encourage innovation and progress, we feel it’s important to direct people to those official locations.

Forum volunteers are also not given access to commercial products, so they would not know why your commercial theme or plugin is not working properly. This is one other reason why volunteers forward you to the commercial product’s vendors. The vendors are responsible for supporting their commercial product.

If you need immediate access to your dashboard, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel (consult your hosting provider’s documentation for specifics on these), navigate to /wp-content/themes/ and rename or delete the directory of your currently active theme. That will force your site to use the default theme (Twenty Twenty-one, etc.).

@t-p I certainly appreciate your response. However, you will note that my inquiry mentioned that this is an older custom theme. I personally built this theme from the ground up. I started developing it in 2008 when I was first introduced to WP. My theme is not available for commercial sale – it is only used by me. When I need help with something (which is rare) I have made a habit of first providing support to other users on the support forums before I ask for help myself. You will note that I have answered more than a dozen questions on this support forum over the last couple of weeks. I did that because I knew I had a few questions to ask myself and I want to ensure that I am giving more to the community than I am taking from it. Just imagine if all WP users were to take that same level of initiative in helping their fellow community members.

You can see my support to other community members on this forum here:

  • This reply was modified 3 hours, 10 minutes ago by wlpdrpat.

Moderator
t-p

(@t-p)

Topic is kept open so that other folks can chime in.

You will note that I have answered more than a dozen questions on this support forum

Your help in these forums is appreciated.

@aatanasov Any thoughts on this one? Thanks.

After significant googling I was able to find a reference to a similar issue with mysqli_real_escape_string on wordpress and the suggested solution was to replace it with esc_sql. I tried it and the error has cleared. I’m now checking to ensure that it works as expected on the frontend.

I’d love to get thoughts on this to confirm if this change is the currently accepted protocol for coding on wordpress. Thanks.

Hi @wlpdrpat,

Since get_post_meta requires a number as a first parameter and the function itself validates the ID, you can simply replace this line:


$custompoststyles = get_post_meta(mysqli_real_escape_string($_GET['postid']), '_custom_css', true);

with this one:


$custompoststyles = get_post_meta(intval($_GET['postid']), '_custom_css', true);

It will escape the unnecessary symbols before passing the postID to get_post_meta. More about the used function can be found on

@aatanasov You are amazing!! Thanks again. I’ve nearly worked out all the bugs at this point and starting to feel signs of relief!!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer