How to get Plugin Slugs?

I am hoping there is a better way You can write your code a bit better, like adding some protection should something fail in your function. One should never take code for granted that it will always work, even if looks like it. Always code with the mindset of that your code will fail. I … Read more

Make attachment pages require a base url

Endpoints are for adding extra query vars to existing routes, I think you just want a vanilla rewrite rule here: function wpd_media_image_rewrite_rule() { add_rewrite_rule( ‘^image/([^/]*)/?’, ‘index.php?post_type=attachment&name=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpd_media_image_rewrite_rule’ ); You might want to loop over valid mime-types there and add a rule for each. You also need to flush rewrites for … Read more

Yoast SEO breadcrumbs: how to create a filter that uses the url slug for breadcrumb titles

Yoast does have a filter for you to use. See here: https://gist.github.com/jmcclellan/b2d97ffee0e924e28fa1 I used this to add “parent” pages to custom post types. We wanted to use pages as our category landers w/ custom post types as children. Yoast would not output the parent page slug by default since there is technically no real relationship, … Read more

Gutenberg Editor: dynamicaly change slug field with an ACF field

I’ve found a way to dynamicaly change the slug field with the short title custom field. jQuery(document).ready(() => { const acfField = ‘field_61f8bacf53dc5’; const inputShortTitle = document.getElementById(‘acf-‘ + acfField); const slugify = (str) => { return str.toLowerCase().replace(/ /g, ‘-‘) .replace(/-+/g, ‘-‘).replace(/[^\w-]+/g, ”); } const updateSlug = () => { wp.data.dispatch(‘core/editor’).editPost({slug: slugify(inputShortTitle.value)}); } if (inputShortTitle !== … Read more

WordPress 3.8.1 Multisite blog slug problem

I fixed this in the following way. Go to the “Network admin”. Then Sites → Edit → Settings → Permalink Structure. Remove blog from it. Then I removed blog from two lines in table which obtained as a result of the query: SELECT * FROM wp_options WHERE option_name = “permalink_structure” OR option_name = “rewrite_rules” Useful … Read more

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