• Resolved !Benni

    (@benniledl)


    Hello ?? ,

    I need to automate creating some posts. They all need to have the same seo settings. Until now I just set the default rank math settings to whatever I needed and created them all automated using the cli.

    In Production Phase I must not change the default Rank Math settings before creating these posts.

    Is there any way to create posts via a php script or cli (php prefered) and define the seo settings for this post?

    Until now I did it like this:

    // First of all change Rank Math SEO Settings
    // define command §TLD is a replacer
    $_command = "wp post create content.txt --post_title=\".§TLD Domain\" --post_name=§TLD-domain --post_category=domains --post_status=publish";
    
    // define array that replaces §TLD
    $tlds = array("be", "best");
    
    // Loop through array
    foreach ( $tlds as $tld ) {
            // Replace Replacer and execute command
    	$command = str_replace("§TLD", $tld, $_command);
    	exec($command, $output);
        echo "\n---\n";
        var_dump($output);
        echo "\n---\n";
        unset($output);
    }
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @benniledl,

    Thank you for contacting support.

    Our plugin doesn’t include support for settings changes via the WP-CLI tool, so this is not possible at the moment.

    With that being said, there are existing feature requests, so we’ve added your vote to our internal suggestions lists. We’ll be sure to let you know if your suggestions are something we can introduce.

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter !Benni

    (@benniledl)

    Hi,

    thank you for your answer.

    Okay so it is not possible with cli but is there a way to do that with some php code?

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @benniledl,

    The data from our plugin gets saved in the postmeta database table for each post unless it’s defaulting to the settings, which in that case it doesn’t get saved in that table and just reads the settings from the options table.

    With this information, if you can incorporate a way into your code of adding the meta keys from our plugin into the postmeta table, it’s possible to do it.

    Don’t hesitate to get in touch if you have any other questions.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CLI create post with custom rank math settings’ is closed to new replies.