# Request to delay post from wordpress

**URL:** https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588
**Category:** WordPress
**Created:** [October 2, 2018, 11:48pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588 "2018-10-02T23:48:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [October 2, 2018, 11:48pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/1 "2018-10-02T23:48:44Z")

</div>

I am using the [WP Offload Media plugin](https://deliciousbrains.com/wp-offload-media/) to send my images to s3 on wordpress, but the images take a minute to move over to s3 when the post is published. The problem is the discourse plugin is immediate so the post gets sent over to discourse with the links to images that are locally hosted, and shortly thereafter the offload plugin sends them to s3, and now the original links are broken in the discourse post. If there was a simple setting to delay the discourse post by say 5 minutes it would resolve this issue.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [October 2, 2018, 11:58pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/2 "2018-10-02T23:58:03Z")

</div>

Doesn’t that plugin include the option to move to S3 from the media library? If so you can get your files into S3 prior to publishing.

Edit: Yes, looks like it does, you can select the images prior to publishing and offload them:

 ![](https://global.discourse-cdn.com/meta/original/3X/b/0/b04249d9982672b888921a10f016c5db8bd91302.jpeg)

It makes much more sense for you to use existing functionality that achieves the same result, than ask for new features to be developed.

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [October 3, 2018, 3:58pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/3 "2018-10-03T15:58:38Z")

</div>

Thanks Stephen, I reached out to the developers and received this response

> The images are sent to S3 as soon as they are uploaded to the Media Library, whether that’s directly with “Add New” or via “Add Media” when editing a post. So while drafting a post any media should be showing S3 URLs.

> If that is correct, but when you publish your post it still sends content with local URLs to Discourse, then it’s likely that whatever plugin you’re using for that is not properly processing “the\_content” via WP’s filters. The following guide may be of help.  
> [Filtering URLs in Custom Content](https://deliciousbrains.com/wp-offload-media/doc/filtering-urls-in-custom-content/)

Can anyone confirm that the discourse plugin is using `the_content`?

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [October 26, 2018, 12:54am UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/4 "2018-10-26T00:54:47Z")

</div>

Here’s another example of a post I just published, I even tried using the update post feature and it did not change. So it actually doesn’t seem to be related to the plugin or delay at all. For some reason, the discourse plugin is taking the local file url instead of cdn url which is actually in the source code.

If you view the source on this page:

> **[Creating Order in Chaos: A Guide to Photographing Forests](https://www.naturephotographers.network/articles/finding-order-in-chaos-a-guide-to-photographing-forests/)**
>
> Photographing forests can be extremely challenging. In this article, Eric describes his process for finding order in the chaos using various techniques to simplify arrangements and compositions.

The first image in post is this:

> **Wordpress Source**
>
> `<img class="alignnone size-full wp-image-1248" src="https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20181023131610/GlowingGroveWEB.jpg" alt="GlowingGroveWEB" width="2133" height="1200" srcset="https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20181023131610/GlowingGroveWEB.jpg 2133w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20181023131610/GlowingGroveWEB-300x169.jpg 300w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20181023131610/GlowingGroveWEB-768x432.jpg 768w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20181023131610/GlowingGroveWEB-1024x576.jpg 1024w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20181023131610/GlowingGroveWEB-600x338.jpg 600w" sizes="(max-width: 2133px) 100vw, 2133px" />`

And the html that was published to discourse was this:

> **Discourse**
>
> ```
> <img class="alignnone size-full wp-image-1248" src="https://naturephotographers.network/wp-content/uploads/2018/10/GlowingGroveWEB.jpg" alt="GlowingGroveWEB" width="2133" height="1200" />
> <h4>Focus On A Single Tree</h4>
> 
> ```

`

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [October 26, 2018, 1:21am UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/5 "2018-10-26T01:21:46Z")

</div>

Have you inspected the database to check if your S3 plugin is updating post\_content or post\_content\_filtered?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [October 26, 2018, 1:45am UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/6 "2018-10-26T01:45:25Z")

</div>

> [@davidkingham](#):
>
> Can anyone confirm that the discourse plugin is using `the_content` ?

No, it isn’t. I’ll look into it some more as to whether or not it should be applying that filter. The main problem I see with it is that if shortcodes get parsed there can be a lot of display issues on Discourse.

For the moment, you can apply the filter yourself, or apply the `as3cf_filter_post_local_to_s3` filter. You can do this by hooking into the `wp_discourse_excerpt` filter that the plugin applies to the post content that’s published from WordPress to Discourse. Only try this if you have someway of accessing the backend of your site in case something goes wrong when adding the code. Try one or the other of these code snippets to your theme’s `functions.php` file.

```plaintext
add_filter( 'wp_discourse_excerpt', 'wpdc_custom_excerpt' );
function wpdc_custom_excerpt( $content ) {
    
    return apply_filters( 'as3cf_filter_post_local_to_s3', $content );
}

```

```plaintext
add_filter( 'wp_discourse_excerpt', 'wpdc_custom_excerpt' );
function wpdc_custom_excerpt( $content ) {

    return apply_filters( 'the_content', $content );
}

```

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 10, 2018, 6:31pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/7 "2018-12-10T18:31:29Z")

</div>

With version `1.7.9` of the [WP Discourse](https://github.com/discourse/wp-discourse) plugin, if the full post content is published to Discourse, the `the_content` filter is applied to the content before it is published. This is being done to remove the markup that WordPress adds to posts that are published with the Block Editor.

Let me know if this causes any issues.

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [December 11, 2018, 10:35pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/8 "2018-12-11T22:35:56Z")

</div>

Looks good, only bit of weirdness is the image caption goes to the right of the image rather than below it now.

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/b/eba1b4a6deb8e6062076278a6948d4ac7daab3a4.jpeg)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 11, 2018, 10:54pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/9 "2018-12-11T22:54:48Z")

</div>

> [@davidkingham](#):
>
> only bit of weirdness is the image caption goes to the right of the image rather than below it now.

I can reproduce that If the image doesn’t take up the full width of the post.

Edit: if images on your forum are being lightboxed, a possible solution to this would be to add something like this to your Discourse theme’s CSS:

```plaintext
.lightbox-wrapper {
    display: block;
}

```

Discourse is displaying `.lightbox-wrapper` as `inline-block`. This is why the caption text can appear to the right of the image. I’m not sure if there will be any issues with using `display: block` instead. I’ll test it out and see.

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [January 16, 2019, 4:53pm UTC](https://meta.discourse.org/t/request-to-delay-post-from-wordpress/98588/10 "2019-01-16T16:53:01Z")

</div>

> [@simon](#):
>
> Edit: if images on your forum are being lightboxed, a possible solution to this would be to add something like this to your Discourse theme’s CSS:

Sorry for the delay, I just tried this and it does not work, unfortunately.

Also, I just published a new post which has centered square images, on discourse it is stretching the images to fill the container even though the html looks correct.

Original post: [Finding Your Muse - Nature Photographers Network](https://naturephotographers.network/articles/finding-your-muse/)

I have the articles section on discourse locked down to members, so here is a screenshot and a portion of the html:

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/8/58ac9f2f9bb4c62ea49a01f823d24f249d480002.jpeg)

```plaintext
<small>Originally published at: https://naturephotographers.network/articles/finding-your-muse/
		</small><br>
<div class="wp-block-image"><figure class="aligncenter is-resized"><img src="https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX-1024x1024.jpg" alt="Music From Dark Spaces IX" class="wp-image-3589" width="512" height="512" srcset="https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX-1024x1024.jpg 1024w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX-150x150.jpg 150w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX-300x300.jpg 300w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX-768x768.jpg 768w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX-600x600.jpg 600w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX-100x100.jpg 100w, https://npn.sfo2.cdn.digitaloceanspaces.com/wp-content/uploads/20190115215008/Music-From-Dark-Spaces-IX.jpg 1500w" sizes="(max-width: 512px) 100vw, 512px" /></figure></div>

```
