How can I force a file download in the WordPress backend?

If I understand you correctly you want to have a URL something like the following whose response to the browser will be the content you generate, i.e. your .CSV file and no generated content from WordPress? http://example.com/download/data.csv I think you are looking for the ‘template_redirect’ hook. You can find ‘template_redirect’ in /wp-includes/template-loader.php which is a … Read more

Get a list of all registered actions

Filters and actions are both assigned to hooks. Functions assigned to hooks are stored in global $wp_filter variable. So all you have to do is to print_r it. print_r($GLOBALS[‘wp_filter’]); PS. add_action function makes a add_filter call. And the latter does $wp_filter[$tag][$priority][$idx]. NOTE: you can directly add this code in functions.php, and you will see a … Read more

Is there a plugin that provides a stackoverflow style editor for wordpress? [closed]

Welcome to WordPress stack exchange! Just yesterday I created WP-Markdown, which enables Markdown on your posts. It also provides the same interface as this website (the toolbar, and live preview) – however, currently only for comments and bbPress forums (if enabled). That said, (since it would be straightforward to do), I am planning on adding … Read more

Where do I put the code snippets I found here or somewhere else on the web?

Whenever you find a piece of code without clear installation instructions it is probably a plugin. The example you gave is a good one, because that is the most common case: add_action(‘template_redirect’, ‘remove_404_redirect’, 1); function remove_404_redirect() { // do something } To use such a snippet, put it into a plugin: Create a new file, … Read more

Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu

Yes. When you register your post type you need to set show_in_menu to the page you would like it displayed on. Adding a custom post type as a sub-menu of Posts Here we set the “movies” post type to be included in the sub-menu under Posts. register_post_type( ‘movies’, array( ‘labels’ => array( ‘name’ => __( … Read more

Best way to overide plugin CSS?

As you suggest, the most elegant approach is when your CSS overrides are loaded after the CSS injected by the plugins. This is quite easy to achieve – you just need to make sure that your header.php calls wp_head() before it references your style sheet: <head> <!– all the usual preamble stuff goes here –> … Read more

Translate a plugin using .po .mo files

The Editor There are others, but this is most used: Poedit, a cross-platform gettext catalogs (.po files) editor. The Formats .mo stands for Machine Object — compiled export of the .po file which is used by WordPress .po stands for Portable Object — editable text file with the translations strings — based on the master … Read more

What are the differences between WPINC and ABSPATH?

They are defined as follows: define( ‘ABSPATH’, dirname(dirname(__FILE__)) . “https://wordpress.stackexchange.com/” ); define( ‘WPINC’, ‘wp-includes’ ); dirname is a PHP function that returns the path of the parent directory, and wp-includes is pretty self explanatory. I would say ABSPATH is better because it’s one of the first things WP loads and it also looks better:) But … Read more

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