• Can anyone help with a custom hook/code to auto change the post in a category to another category every day at exactly 12:00AM.

    I have three categories ( general, special, free )… I have contents with this categories; general & free. So I want any post in the FREE category to change automatically to SPECIAL 12:00AM Daily. So I will have the post in General + SPECIAL category.

    • This topic was modified 4 years, 9 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 14 replies - 31 through 44 (of 44 total)
  • Thread Starter Mikel

    (@ogmic)

    Screenshot of the file set to 755

    https://ibb.co/VMC9QFM
    https://ibb.co/5WPg4zK

    Thread Starter Mikel

    (@ogmic)

    Screenshot of Cron job

    https://ibb.co/88w6tKH

    If you are getting Connection Refused, are you are sure that this file path is correct :
    /home/surepayf/public_html/wp-load.php
    you may have to explicitly call the php file.
    You may have to ask your host what path to use to reference the php binary file.
    Howerver, it is foten :
    /usr/bin/php
    in that case you would need to change php in your command line in the cron to :
    /usr/bin/php

    Thread Starter Mikel

    (@ogmic)

    Also – again this is coming from your nocache header :
    https://www.php.net/manual/en/function.session-cache-limiter.php
    The expiry date is listed as :
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    which is a nod to a php developer.

    @corrinarusso Is there any way to fix this, what is the advantage/disadvantage?

    There’s nothing really to fix. But also this is getting very technical.

    Here, see attached re: your cron :

    View post on imgur.com

    Thread Starter Mikel

    (@ogmic)

    Howerver, it is foten :
    /usr/bin/php
    in that case you would need to change php in your command line in the cron to :
    /usr/bin/php

    I have included this to my Cron job

    Thread Starter Mikel

    (@ogmic)

    There’s nothing really to fix. But also this is getting very technical.

    Here, see attached re: your cron :
    https://imgur.com/a/O9kTDOh

    Okay, will do that now

    Thread Starter Mikel

    (@ogmic)

    @corrinarusso I didn’t receive any mail again, and the posts are not moved

    I dunno @ogmic
    Like I said, the script is very easy and straightforward.
    It works as expected on my own server.
    I suggest you reach out to your host or ask a developer.
    There’s only so much I can do remotely, and without proper access.

    Thread Starter Mikel

    (@ogmic)

    @corrinarusso please I need your help with something please.

    Thread Starter Mikel

    (@ogmic)

    I will be very very happy if you can help me out. Can I reach you on WhatsApp? @corrinarusso

    Hi @ogmic
    I’ve never heard of WhatsApp – but I’m also not allowed to solicit work or contact info on the forums.
    It should be very straight forward, so I think you must be overlooking something simple.
    Can you show me what you have so far ?

    The code I provided early works for sure – as I have it running successful on my own server :

    <?php
    // change the path to your wp-load.php file 
    require_once('/home/full-path-to-your-root-wordpress/public_html/your-website.com/wp-load.php'); 
    //$output = shell_exec('wp post list --category_name="FREE" --format=ids 2>1&');
    //echo $output."\n";
    global $wpdb;
    $oldCatSlug = 'FREE';
    $newCatSlug = 86; // you need to insert an integer here that matches your SPECIAL category
    $category = get_category_by_slug( $oldCatSlug );
    
    if ( $category ) {
        $posts = get_posts( array(
            'numberposts' => -1,
            'category_name' => 'FREE',
            )
        );
        if ( $posts ) {
            foreach ( $posts as $post ) {
                // update categories the match FREE
                // see https://codex.www.ads-software.com/Function_Reference/wp_set_post_categories
                wp_set_post_categories( $post->ID, $newCatSlug, false ); // set this to true if you want th
    is category appended
            }
        }
    }
    ?>
    Thread Starter Mikel

    (@ogmic)

    @corrinarusso

    Please I need help on this please…

    I have a mobile recharge website created with woocoomerce. Presently, I process orders manually because I don’t know how to make it work automatically.

    Just of recent, I got an API from two vendors so that I can integrate with my website.

    The challenge/problem is that I don’t know how to do it – I have zero idea about how to make it work.

    ABOUT MY WEBSITE WORKS;

    I have 5 products(One of each representing different mobile networks, with several attributes serving as data plans options, and an add-on(woocoomerce product add-on) used to receive users phone number). I also have a wallet system, so that users can pay easily from their wallet – without having to use the card everytime on every order.

    WHERE I NEED YOUR HELP;

    ? How do I make it possible so that once an order has been paid for on my website, it will automatically be submitted to the API for processing(automatically)

    ? And if possible also get a response… To update the order status on my website.

    • This reply was modified 4 years, 9 months ago by Yui. Reason: redundant link(s) deleted

    Hi @ogmic

    People need to know the entire picture, and providing accurate answers to these questions is in no way straight forward. There are far too many different variables with your website, and especially with a vendor API(s) to be able to give you strong advice.

    There are tonnes of articles that describe how to automate your processes in WooCommerce :
    https://woocommerce.com/posts/automation-for-ecommerce-stores/

    When I am connecting my websites to a third party API, I use Zapier most often :
    https://zapier.com/

    If you don’t know how to do this, you’ll need to either learn or hire a developer. Your ask is too complicated for simple forum discussions.

Viewing 14 replies - 31 through 44 (of 44 total)
  • The topic ‘Need help with a code’ is closed to new replies.