• I am using a WordPress install not publicly accessible and then using WP static to publish the posts online as static HTML. This plugin is posting the local non-routable URL. How can I specify the public URL instead?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Jan Boddez

    (@janboddez)

    Oh, I hadn’t yet heard of that use case!

    You should be able to filter the status messages, like use PHP’s str_replace() to replace the local with your public domain. This of course requires you’re able to add code snippets someplace, like in functions.php, a custom (must-use) plugin, or through the use of a separate “code snippets” plugin:

    Just a quick example:

    add_filter( 'share_on_mastodon_status', function( $status, $post ) {
    $status = str_replace( 'http://localhost.test/', 'https://www.example.org/', $status );

    return $status;
    }, 10, 2 );

    This would modify the message before it gets sent to your Mastodon server.

    Of course, depending on how or when the static pages are pushed to your web host, Mastodon instances might temporarily hit a 404 and cache the wrong link preview data. (It might be possible to work around that by setting a delay, under the plugin’s advanced settings. But maybe I’m overthinking things.)

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.