Tag: PHP

  • What’s Coming in WordPress 7.0: A Look at the New Features and Improvements

    WordPress has come a long way from its humble beginnings as a blogging platform. With every major release, it continues to evolve into a more powerful and user-friendly content management system. As we look ahead to WordPress 7.0, set for release later this year, the core team has announced some exciting new features that promise to enhance both the user and developer experience.

    Here’s a breakdown of what’s coming in WP 7.0 and why it matters.

    Full-Site Editing (FSE) Gets Smarter

    While Full-Site Editing was introduced in previous versions, WP 7.0 will refine and expand its capabilities. Expect:

    – Smarter block-based theme tools
    – Global style variations that make switching between designs seamless
    – Improved template browsing and creation directly from the Site Editor
    – Enhanced navigation block customization, finally matching the flexibility of traditional menus

    These updates are designed to give both designers and non-coders greater control over site appearance—without needing to touch PHP.

    Performance Boosts

    Performance remains a top priority, and version 7.0 introduces several under-the-hood improvements:

    – Improved object caching, especially for REST API responses
    – Enhanced lazy loading for images and iframes, reducing page load times
    – A new defer” attribute added to script loading for better Core Web Vitals
    – Database query optimization in multisite setups

    Whether you’re running a blog or a WooCommerce store, these enhancements will help your site run faster and smoother.

    Block Editor Enhancements

    The Gutenberg editor gets a significant upgrade with:

    – New blocks: Table of contents, image comparison, progress bar
    – Block-level revisions, letting you revert changes to individual blocks
    – Improved drag-and-drop functionality and block locking to prevent accidental edits
    – Better accessibility and keyboard navigation throughout the editor

    The block editor continues to mature into a more intuitive page builder, closing the gap with premium solutions.

    Better Security and Access Control

    Security updates in WordPress 7.0 include:

    – Role-based block access, so certain blocks can be hidden from non-admin users
    – Tighter REST API permission checks
    – Support for passkeys as a login method
    – Continued work toward Core auto-updates by default, reducing risk on neglected installs

    Security-conscious users will appreciate these thoughtful additions.

    Plugin and Theme Developer Improvements

    For developers, WordPress 7.0 brings:

    – New interactivity API for building dynamic blocks without React overhead
    – Script module support type=”module”
    – Better block style registration and tooling in the theme.json
    – Early support for PHP 9.0 compatibility checks

    These improvements not only modernize development workflows but also lay the groundwork for future innovation.

    Multilingual Support on the Horizon?

    One of the most requested features—native multilingual support—is finally getting traction. While full support may not land in 7.0, early groundwork is being laid. Expect:

    – Language switching APIs for developers
    – Basic language context awareness in block themes
    – UI components that will make it easier to build multilingual plugins

    It’s a strong hint that core multilingual capabilities may be included in future 7.x releases.

    WordPress 7.0 isn’t just about adding flashy features—it’s about refining the experience, improving performance, and moving closer to a modern, decoupled CMS. Whether you’re a blogger, developer, or agency, this release is shaping up to be one of the most impactful updates in recent memory.

  • WooCommerce: Add a product to cart automatically based on another product’s variation ID

    If you want to add a product to your cart based on another product’s ID or variation or a configurable product, then this code snippet might help. Was searching how to do this until I found one in Stack Overflow. The function is based on the first code example on this website post:
    https://www.tychesoftwares.com/how-to-automatically-add-a-product-to-your-woocommerce-cart-in-3-different-scenarios/

    Basically, that code adds a specific product to cart based on the item’s category. So If added a product from category XYZ, then another item, a free one or not, will also be added to your woocommerce cart automatically.

    But what if you want to add a product based on the options selected on a configurable product / variable product. Then the code below will help do exactly what you need

    function bv_atc() {
    if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
    foreach( WC()->cart->get_cart() as $cart_item_key => $values ) {
    $a = array(10,20,30);
    $b = array(40,50,60);

    if( in_array( $values['variation_id'], $a ) ) {
    WC()->cart->add_to_cart(1);
    } else if ( in_array( $values['variation_id'], $b ) ) {
    WC()->cart->add_to_cart(2);
    } else {
    //if you want to do something else like adding a random item, do it here.
    }
    }
    }
    add_action( 'woocommerce_add_to_cart', 'bv_atc', 10, 2 );

    Just add the code snippet to your functions.php and replace the values in the array. In my array I have two sets of items. Each item will add a different product to cart.

    Just add more if conditions if you have other items that you want to be added to your cart based on the selected variations of a specific product.

    Credits to Shaikh at Stackoverflow:
    https://stackoverflow.com/questions/68077784/check-if-this-variation-id-exists-in-cart-then-add-another-item-to-cart

  • JetPack is getting smarter and smarter

    Recently today, I upgraded my PHP version to 7.4.4. After a few minutes, I received an e-mail that my website is offline. It says that “Your Site is Experiencing a Technical Issue”. But good thing, I have JetPack. Gone are the days when your WordPress website is down or just blank white, and you don’t know what to do.

    Now, non-living things are getting smarter and smarter. I now know why my website is down and what’s the root cause of the issue. No need to troubleshoot it anymore. You’ll receive a link to enter your website in “recovery mode”, and you will also receive via e-mail all the details about which plugins caused the issue.

    Mine was this:

    Current plugin: Audio player (version 2.0.4.6)

    Error Details
    =============
    An error of type E_PARSE was caused in line 903 of the file /wp-content/plugins/audio-player/audio-player.php. Error message: syntax error, unexpected ‘new’ (T_NEW)

    So I just went ahead to my server and deleted that specific plugin that I don’t even use anymore. And eureka! My website is back online! Easy peasy right?

  • Single PHP file to send push notification via OneSignal REST API

    Here’s a single php file where you can send a push notification using your OneSignal account via REST API. It’s simple and straightforward using the code example at OneSignal.com. This one is more complete as the code example is just the curl_setopt code. But what if you don’t know how to POST the code from your form to send a message using the basic example from OneSignal REST API? Example in this link are all just API parameters with basic code example, no actual code example with an HTML form that will work if you copy paste it.
    (more…)

  • Formidable Calendar Custom Time Slots Per Hour of the Day

    Formidable form building is one of the best and most extensive, fully customisable, WordPress plugin out there. You can create all types of forms you can think of. From a simple contact form, to a complex booking form, or even a full-featured user database with lots of filters and search features.

    But even if Formidable Pro is this powerful, there are still some things that Formidable Pro cannot do. One is allowing different number of slots per hour of the day. Out of the box, Formidable’s calendar and time field can let you limit the number of slots per day by a few lines of code.
    (more…)

  • Wow! PHP 5.4.0 has been released!

    Wow! PHP 5.4.0 has been released!


    I recently updated my server to 5.3.10 and now PHP 5.4.0 has been released! The PHP said that the release is a major leap forward in the 5.x series, which includes a huge number of new features and bug fixes.

    They key new features of PHP 5.4 are traits, DTrace support, a shortened array syntax, a built-in webserver for testing purposes and a whole lot more, check it out here. You can download the latest stable version here if you want to try it out. This PHP version greatly improves performance and memory footprint. There were also more than 100 bugs fixed in this version.
    (more…)

  • Worpress error on line 2 at column 6: XML declaration allowed only at the start of the document


    The error on line 2 at column 6: XML declaration allowed only at the start of the document on my WordPress feed is really annoying. I spent more than 10 hours trying to fix this error myself. I’m really frustrated because I’ve tried all the solutions I found online but to no avail. I’m almost about to loose hope and just pay someone on fiverr for $5 to fix my error. But my pride stopped me. I’ll be such a loser if I can’t fix this simple error myself. Other have fixed it, a $5.00 can fix it, why can’t I? (more…)

  • Modify the WordPress Tag Cloud Widget Easily

    Modify the WordPress Tag Cloud Widget Easily


    There are numerous ways of how to modify the WordPress tag cloud widget, but there’s an easy way to modify it. I searched about how to modify such, and landed on different blogs sharing different methods to modify the widget. I also landed on this page which tells everyone to modify the WordPress core. But I don’t think it’s the best solution to customize your WordPress Tag cloud.
    (more…)