Support

Account

Home Forums General Issues excessive CPU/mySQL usage

Unread

excessive CPU/mySQL usage

  • Hi all,

    My host (shared hosting) who is pretty reasonable has flagged my account for excessive usage on the shared server. One suggestion is that my custom blog module could be causing issues, because the wp-admin/admin-ajax.php file is flagged as constantly running.

    I modified the Blog.php in order to display custom fields contents… and we now have 19 custom fields
    here is the code I am using. It triggers in two places in the Blog.php file. Suggestions for improving the display are welcome – I hacked this together and suspect that it is inefficient.


    /* INSERT START position for Advanced Custom Fields Content -- aka vendor-links */
    $buttons = get_fields(); //get_field('repeater-field-name', 'options')
    if( $buttons ) {
    echo
    '<div class="button-strip et_pb_button_module_wrapper et_pb_button_3_tb_body_wrapper">';
    foreach( $buttons as $but_name => $but_value ) {
    if( !empty( $but_value ) ) {
    $but_label = get_field_object($but_name);
    $but_type = $but_label['type'];
    if( $but_type == 'url' )
    echo
    '', $but_label['label'] ,'';
    elseif( $but_type == 'text' && $but_name == 'special_button_form' ) {
    echo
    '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="', $but_value ,'">';
    echo
    '<input type="image" src="https://www.readajs.com/wp-content/uploads/2023/01/checkout-paypal.png" border="0" width="150px" name="submit" alt="PayPal - The safer, easier way to pay online!">

    </form>';
    }
    elseif( $but_type == 'text' && $but_name == 'payhip_code' ) {
    echo
    'Order directly!';
    }
    elseif( $but_type == 'text' && $but_name == 'preorder_code' ) {
    echo
    'Pre-Order directly!';
    }
    }
    }
    echo
    '</div>';
    }
    /* INSERT FINISH position for Advanced Custom Fields Content -- aka vendor-links */

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.