Tag Archives: WordPress

Allow WordPress Embedded Posts with Global X-Frame-Options for Nginx Servers

The problem: when you enables X-Frame-Options globally. You won’t be able to embed your posts with latest WordPress embed posts method.

The solution: you can simply exclude it in your Nginx configuration. I’ll use Nginx map for better performance:

map $request_uri $x_frame_options_headers {
  default                 SAMEORIGIN;
  # Matching WordPress embed page, ie. https://example.com/my-post/embed#?secret=vLi4CQcWkH
  ~/embed                 "";

# Don't allow the browser to render the page inside an frame or iframe
add_header X-Frame-Options $x_frame_options_headers;
Embedding Demo

禁用 global_terms_enabled 以允许 WordPress Mutisite 用户编辑 category slug 与 tag slug

方法一,编辑数据库 wp_sitemeta 表中的 global_terms_enabled,将值设置为 0


// disable global terms to make category, link_category, and tag slugs editable
// you can also set global_terms_enabled value to 0 on wp_sitemeta table
function disable_global_terms($enablefalse) {
   return 0;
add_filter( 'global_terms_enabled', 'disable_global_terms' );

Postfix 发送邮件至本地报错 status=bounced (unknown user: “***”) 的解决办法

有时候如果你需要发送的邮件与本机 hostname 相同时(例如 WordPress 帐号需要重置密码),但发现无法收到邮件,那么你打开 log 可能会发现这样的问题

postfix/local[19499]: B2E312E701: to=, relay=local, delay=0.05, delays=0.03/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "usr")

一个简单的办法是修改 Postfix 的 main.cf 配置文件,将 mydestination 设置为空

mydestination = 


postfix/smtp[19838]: 68C072E701: to=, relay=aspmx.l.google.com[]:25, delay=1.4, delays=0.03/0.01/0.29/1.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1335520194 t9si6294951pbj.252)