How should esc_url be combined with trailingslashit?

It is recommended to escape as late as possible, but the function simply adds a trailing slash (/) (after removing existing one, if any), and I noticed core also used trailingslashit( esc_url() ), so I guess that’s how we would do it.

  • But that is not a definitive answer to your question (which is interesting, BTW), because there’s no official statement regarding which format should be used.

However, there’s a similar function, namely user_trailingslashit(), which conditionally adds the trailing slash and applies a filter hook that’s also named user_trailingslashit, hence in that case, the format should always be esc_url( user_trailingslashit() ).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)