WordPress URL rewrite problem

My recommendation is to register a custom post type. You can call it products, and then all posts placed under Products will get the http://domain.com/products/some-product rewrite. Once it’s its own post type, you can specify a custom template for it, single-product.php, and you can add any custom fields, classes, etc. from there.

Problem with shortcodes in external file

Shortcodes and Tags At first, please keep in mind that your understanding of tags is actually a shortcode. A Tag is used to add meta information to content, while a shortcode is used for adding functionality, usually to be called from inside the content. To your Problem As @s_ha_dum pointed out, you should implement your … Read more

Save something to global var in add_filter

I ran a test and the following works: global $testMe; $testMe = 0; function my_acf_update_value( $value, $post_id, $field ) { global $testMe; $testMe = $value; return $value; } add_filter(‘acf/update_value/key=field_5308e5e79784b’, ‘my_acf_update_value’, 10, 3); // Test: Apply the filter apply_filters(‘acf/update_value/key=field_5308e5e79784b’,’a’,’b’,’c’); // end Test echo $testMe; // prints ‘a’ So, in principle, your code is functional. There are … Read more

Activate short codes for all post queries?

There is a way to apply that to all post content. function sc_all_content_wpse_137734($posts) { foreach ($posts as &$p) { $p->post_content = do_shortcode($p->post_content); } return $posts; } add_filter(‘the_posts’,’sc_all_content_wpse_137734′); I would suggest that this is a very, very good way to break things. Plugins and themes will not expect shortcodes to be rendered that early, and the … Read more

Admin filter/error if post title is too long

The key thing I think you’re missing is understanding that WordPress doesn’t use a linear path for saving posts. Because posts are autosaved you’ll want to handle this in a way that defines it according to it’s publish status rather than it’s save state. Basically, instead of trying to truncate or adjust the title, do … Read more

Filter on widget-title does not work with custom links

The “Links” widget uses wp_list_bookmarks, which outputs a nested list similar to: <li> <h2>[category]</h2> <ul class=”xoxo blogroll”> [links] </ul> </li> You can override [category] using the link_category filter: function wpse_147543_link_category( $title ) { $title=”title”; return $title; } add_filter( ‘link_category’, ‘wpse_147543_link_category’ );

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